from django.contrib import admin from models import * # from forms import ArticleForm class ArticleInline(admin.StackedInline): model = Article extra = 4 filter_horizontal = ['authors'] class ImageInline(admin.StackedInline): model = Image extra = 4 class DocumentInline(admin.StackedInline): model = Document extra = 4 class IssueAdmin(admin.ModelAdmin): list_display = ('name', 'date', 'published',) inlines = [ArticleInline, ImageInline, DocumentInline] save_on_top = True class ContributorAdmin(admin.ModelAdmin): pass class DocumentAdmin(admin.ModelAdmin): list_filter = ['issue'] search_fields = ('doc_txt',) list_display = ('title', 'doc_txt',) class ImageAdmin(admin.ModelAdmin): list_filter = ['issue'] class ArticleAdmin(admin.ModelAdmin): filter_horizontal = ['authors'] list_filter = ['issue'] # form = ArticleForm admin.site.register(Issue, IssueAdmin) admin.site.register(Article, ArticleAdmin) admin.site.register(Document, DocumentAdmin) admin.site.register(Contributor, ContributorAdmin) admin.site.register(Image, ImageAdmin)