1 from django.contrib import admin
2 from django import forms
3 from philo.admin.base import COLLAPSE_CLASSES
4 from philo.admin.nodes import ViewAdmin
5 from philo.models.pages import Page, Template, Contentlet, ContentReference
6 from philo.forms import ContentletInlineFormSet, ContentReferenceInlineFormSet, ContentletForm, ContentReferenceForm
9 class ContentletInline(admin.StackedInline):
13 formset = ContentletInlineFormSet
16 template = 'admin/philo/edit_inline/tabular_container.html'
19 class ContentReferenceInline(admin.StackedInline):
20 model = ContentReference
23 formset = ContentReferenceInlineFormSet
24 form = ContentReferenceForm
26 template = 'admin/philo/edit_inline/tabular_container.html'
29 class PageAdmin(ViewAdmin):
30 add_form_template = 'admin/philo/page/add_form.html'
33 'fields': ('title', 'template')
36 list_display = ('title', 'template')
37 list_filter = ('template',)
38 search_fields = ['title', 'contentlets__content']
39 inlines = [ContentletInline, ContentReferenceInline] + ViewAdmin.inlines
42 class TemplateAdmin(admin.ModelAdmin):
43 prepopulated_fields = {'slug': ('name',)}
46 'fields': ('parent', 'name', 'slug')
49 'classes': COLLAPSE_CLASSES,
50 'fields': ('documentation',)
56 'classes': COLLAPSE_CLASSES,
57 'fields': ('mimetype',)
62 list_display = ('__unicode__', 'slug', 'get_path',)
65 admin.site.register(Page, PageAdmin)
66 admin.site.register(Template, TemplateAdmin)