Newer
Older
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from newsbox.admin import NewsboxAdmin, NewsboxSEOAdmin, NewsboxExpiredAdmin
from .models import News, NewsSEO, NewsExpired, NewsComplete, NewsExtended
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
class NewsAdmin(NewsboxAdmin):
pass
admin.site.register(News, NewsAdmin)
class NewsSEOAdmin(NewsboxSEOAdmin):
pass
admin.site.register(NewsSEO, NewsSEOAdmin)
class NewsExpiredAdmin(NewsboxExpiredAdmin):
pass
admin.site.register(NewsExpired, NewsExpiredAdmin)
class NewsCompleteAdmin(NewsboxSEOAdmin, NewsboxExpiredAdmin):
pass
admin.site.register(NewsComplete, NewsCompleteAdmin)
class NewsExtendedAdmin(NewsboxSEOAdmin, NewsboxExpiredAdmin):
def get_fieldsets(self, request, obj=None):
fieldsets = super(NewsExtendedAdmin, self).get_fieldsets(request, obj)
fieldsets[0][1]['fields'].append('general_field')
fieldsets[2][1]['fields'].append('content_field')
fieldsets[3][1]['fields'].append('seo_field')
return fieldsets
def get_list_display(self, request):
list_display = super(NewsExtendedAdmin, self).get_list_display(request)
list_display.append('seo_field')
return list_display
admin.site.register(NewsExtended, NewsExtendedAdmin)