From dc97b6df23b0738049569a26423d4b3f4dee909d Mon Sep 17 00:00:00 2001 From: sanj Date: Sun, 14 Mar 2010 23:11:58 +0530 Subject: [PATCH] forgot to add erang admin.py --- itf/erang/admin.py | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 itf/erang/admin.py diff --git a/itf/erang/admin.py b/itf/erang/admin.py new file mode 100644 index 0000000..935edb6 --- /dev/null +++ b/itf/erang/admin.py @@ -0,0 +1,44 @@ +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) +