1 from django.contrib import admin
2 from django import forms
3 from philo.admin import widgets
4 from philo.admin.base import COLLAPSE_CLASSES
5 from philo.admin.nodes import ViewAdmin
6 from philo.models.pages import Page, Template, Contentlet, ContentReference
7 from philo.forms import ContentletInlineFormSet, ContentReferenceInlineFormSet, ContentletForm, ContentReferenceForm
10 class ContentletInline(admin.StackedInline):
14 formset = ContentletInlineFormSet
17 template = 'admin/philo/edit_inline/tabular_container.html'
20 class ContentReferenceInline(admin.StackedInline):
21 model = ContentReference
24 formset = ContentReferenceInlineFormSet
25 form = ContentReferenceForm
27 template = 'admin/philo/edit_inline/tabular_container.html'
30 class PageAdmin(ViewAdmin):
31 add_form_template = 'admin/philo/page/add_form.html'
34 'fields': ('title', 'template')
37 list_display = ('title', 'template')
38 list_filter = ('template',)
39 search_fields = ['title', 'contentlets__content']
40 inlines = [ContentletInline, ContentReferenceInline] + ViewAdmin.inlines
43 class TemplateAdmin(admin.ModelAdmin):
44 prepopulated_fields = {'slug': ('name',)}
47 'fields': ('parent', 'name', 'slug')
50 'classes': COLLAPSE_CLASSES,
51 'fields': ('documentation',)
57 'classes': COLLAPSE_CLASSES,
58 'fields': ('mimetype',)
63 list_display = ('__unicode__', 'slug', 'get_path',)
66 admin.site.register(Page, PageAdmin)
67 admin.site.register(Template, TemplateAdmin)