it/itf/emailer/admin.py

48 lines
1.2 KiB
Python
Raw Permalink Normal View History

2011-12-01 21:12:20 +00:00
from django.contrib import admin
from models import *
from markitup.widgets import MarkItUpWidget
# from forms import ArticleForm
class ImageInline(admin.StackedInline):
model = ArticleImage
extra = 4
class BBInline(admin.StackedInline):
formfield_overrides = {models.TextField: {'widget': MarkItUpWidget}}
model = BulletinBoardItem
extra = 3
class WeblinkInline(admin.StackedInline):
formfield_overrides = {models.TextField: {'widget': MarkItUpWidget}}
model = Weblink
extra = 4
class ArticleInline(admin.StackedInline):
formfield_overrides = {models.TextField: {'widget': MarkItUpWidget}}
model = EmailerArticle
extra = 2
class IssueAdmin(admin.ModelAdmin):
list_display = ('title', 'issue_no', 'date', 'published',)
inlines = [WeblinkInline, BBInline, ArticleInline]
list_editable = ('published',)
save_on_top = True
formfield_overrides = {models.TextField: {'widget': MarkItUpWidget}}
class ArticleAdmin(admin.ModelAdmin):
list_filter = ['issue']
inlines = [ImageInline]
# form = ArticleForm
admin.site.register(EmailerIssue, IssueAdmin)
admin.site.register(EmailerArticle, ArticleAdmin)
# admin.site.register(Document, DocumentAdmin)
admin.site.register(Weblink)
admin.site.register(BulletinBoardItem)