diff --git a/article/forms.py b/article/forms.py index e476d26b..ccf65d08 100644 --- a/article/forms.py +++ b/article/forms.py @@ -46,7 +46,7 @@ class BlogForm(forms.Form): self.fields['descriptions_%s' % code] = forms.CharField(label='Дескрипшен', required=False, max_length=255, widget=forms.TextInput(attrs={'style':'width: 550px'})) - def save(self, author, article=None): + def save(self, author, article=None, commit=True): data = self.cleaned_data # create new Article object or get exists if not article: @@ -55,7 +55,7 @@ class BlogForm(forms.Form): article.type = self.type if not getattr(article, 'slug', None): - article.slug = data['slug'] + article.slug = data['slug'] if data['logo']: article.logo = data['logo'] @@ -77,8 +77,8 @@ class BlogForm(forms.Form): #for item in data['tag']: # article.tag.add(item) - article.save() - + if commit == True: + article.save() return article def clean_tag(self): diff --git a/article/models.py b/article/models.py index 352d2f08..2be01f4a 100644 --- a/article/models.py +++ b/article/models.py @@ -59,6 +59,7 @@ class Article(TranslatableModel): "set a custom description."), default=False) created = models.DateTimeField(auto_now_add=True) modified = models.DateTimeField(auto_now=True) + draft = models.BooleanField(_(u'Черновик'), default=False, db_index=True) #translated fields translations = TranslatedFields( @@ -234,4 +235,4 @@ class Article(TranslatableModel): .order_by('-publish_date')[:3]) -post_save.connect(post_save_handler, sender=Article) \ No newline at end of file +post_save.connect(post_save_handler, sender=Article) diff --git a/templates/admin/article/article_admin_list.html b/templates/admin/article/article_admin_list.html index ad2a85a4..a0d9f5f1 100644 --- a/templates/admin/article/article_admin_list.html +++ b/templates/admin/article/article_admin_list.html @@ -1,20 +1,22 @@ {% extends 'base.html' %} +{% load i18n %} + {% block body %}
| Заголовок | -Автор | +{% trans "Заголовок" %} | +{% trans "Автор" %} | {% ifnotequal item.author None %}{{ item.author }} {% endifnotequal %} | - Изменить + {% trans "Изменить" %} | - Копировать + {% trans "Копировать" %} | - Удалить + {% trans "Удалить" %} | @@ -46,8 +48,8 @@
|---|