it/itf/bestpractices/admin.py

32 lines
925 B
Python
Executable File

from django.contrib import admin
from models import *
from markitup.widgets import MarkItUpWidget
class ImageInline(admin.StackedInline):
model = BestPracticeImage
extra = 2
class StoryInline(admin.StackedInline):
formfield_overrides = {models.TextField: {'widget': MarkItUpWidget}}
model = BestPracticeStory
extra = 3
class LinkInline(admin.StackedInline):
model = BestPracticeLink
extra = 3
class BestPracticeAdmin(admin.ModelAdmin):
inlines = [ImageInline, LinkInline, StoryInline]
list_filter = ['category']
formfield_overrides = {models.TextField: {'widget': MarkItUpWidget}}
admin.site.register(BestPractice, BestPracticeAdmin)
admin.site.register(BestPracticeCategory)
admin.site.register(BestPracticeImage)
admin.site.register(BestPracticeLink)
admin.site.register(Guideline)
admin.site.register(Glossary)
admin.site.register(BestPracticeDownload)
admin.site.register(BestPracticeFAQ)