# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.contrib import admin from newsbox_cms.admin import NewsboxCMSAdmin from newsbox.admin import NewsboxSEOAdmin, NewsboxExpiredAdmin from newsbox_i18n.admin import NewsboxI18NAdmin from .models import News, NewsComplete, NewsExtended class NewsAdmin(NewsboxI18NAdmin, NewsboxCMSAdmin): pass admin.site.register(News, NewsAdmin) class NewsCompleteAdmin(NewsboxI18NAdmin, NewsboxCMSAdmin, NewsboxSEOAdmin, NewsboxExpiredAdmin): pass admin.site.register(NewsComplete, NewsCompleteAdmin) class NewsExtendedAdmin(NewsboxI18NAdmin, NewsboxCMSAdmin, 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)