diff options
author | Tiberiu Ichim <tiberiu.ichim@gmail.com> | 2019-01-05 12:24:24 +0100 |
---|---|---|
committer | Tiberiu Ichim <tiberiu.ichim@gmail.com> | 2019-01-05 12:24:24 +0100 |
commit | 0060b2ec28f00b59c0f0d3fa19a1715f1c7c6513 (patch) | |
tree | 0b307f41eb9464d13114e6c5b21db373c7546ac6 /weblog/admin.py | |
parent | 0e0f98ed346f0d2a6fb8fbbec49090d183ba996f (diff) | |
download | w3blog-0060b2ec28f00b59c0f0d3fa19a1715f1c7c6513.tar.gz w3blog-0060b2ec28f00b59c0f0d3fa19a1715f1c7c6513.zip |
Autopep8 some files
Diffstat (limited to 'weblog/admin.py')
-rwxr-xr-x | weblog/admin.py | 8 |
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) |