aboutsummaryrefslogtreecommitdiff
path: root/weblog/admin.py
diff options
context:
space:
mode:
authorYaroslav <contact@yaroslavps.com>2019-01-10 21:11:59 +0300
committerYaroslav <contact@yaroslavps.com>2019-01-10 21:11:59 +0300
commit5c677b866d8fa915384a1f4ccc4af327a5205685 (patch)
treee5bec1705b6392438c2635c8aa91a1879c452d9e /weblog/admin.py
parent7d9891f11a8b9a354eafeabdaf691a7693db3840 (diff)
parent468d6c86a076623e5ea7c38cd8b2547e6f9f1529 (diff)
downloadw3blog-5c677b866d8fa915384a1f4ccc4af327a5205685.tar.gz
w3blog-5c677b866d8fa915384a1f4ccc4af327a5205685.zip
Merge branch 'tiberiuichim-master' into testing
Merging into testing instead of master to make some changes before bundling it into a patch.
Diffstat (limited to 'weblog/admin.py')
-rwxr-xr-xweblog/admin.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/weblog/admin.py b/weblog/admin.py
index 1b4e128..aa5acfb 100755
--- a/weblog/admin.py
+++ b/weblog/admin.py
@@ -7,18 +7,22 @@ from .models import BlogPost, Translation, PostComment, Category, CategoryTransl
blogPostInlines = []
categoryInlines = []
+
class TranslationInline(admin.StackedInline, SummernoteInlineModelAdmin):
model = Translation
extra = 1
+
class CategoryTranslationInline(admin.StackedInline):
model = CategoryTranslation
extra = 1
+
class PostCommentInline(admin.StackedInline):
model = PostComment
extra = 0
+
if blog_settings['multilingual']:
blogPostInlines.append(TranslationInline)
categoryInlines.append(CategoryTranslationInline)
@@ -26,6 +30,7 @@ if blog_settings['multilingual']:
if blog_settings['enable_comments']:
blogPostInlines.append(PostCommentInline)
+
class BlogPostAdmin(SummernoteModelAdmin):
list_display = ['title', 'author', 'publish_date']
list_filter = ['publish_date', 'categories']
@@ -36,11 +41,14 @@ class BlogPostAdmin(SummernoteModelAdmin):
if not blog_settings['multilingual']:
self.exclude = ('original_language', )
form = super(BlogPostAdmin, self).get_form(request, obj, **kwargs)
+
return form
+
class CategoryAdmin(admin.ModelAdmin):
list_display = ['name']
inlines = categoryInlines
+
admin.site.register(BlogPost, BlogPostAdmin)
admin.site.register(Category, CategoryAdmin)