+class NodeForm(TreeForm):
+ def get_instance_class(self):
+ return Node
+
+ def get_validator_args(self):
+ return [self.instance, 'instance']
+
+
+class PageAdminForm(NodeForm):
+ class Meta:
+ model=Page
+
+
+class RedirectAdminForm(NodeForm):
+ class Meta:
+ model=Redirect
+
+
+class FileAdminForm(NodeForm):
+ class Meta:
+ model=File
+
+
+class NodeAdmin(EntityAdmin):
+ pass
+
+
+class RedirectAdmin(NodeAdmin):
+ fieldsets = (
+ (None, {
+ 'fields': ('slug', 'target', 'status_code')
+ }),
+ ('URL/Tree/Hierarchy', {
+ 'classes': COLLAPSE_CLASSES,
+ 'fields': ('parent',)
+ }),
+ )
+ list_display=('slug', 'target', 'path', 'status_code',)
+ list_filter=('status_code',)
+ form = RedirectAdminForm
+
+
+class FileAdmin(NodeAdmin):
+ prepopulated_fields = {'slug': ('file',)}
+ fieldsets = (
+ (None, {
+ 'fields': ('file', 'slug', 'mimetype')
+ }),
+ ('URL/Tree/Hierarchy', {
+ 'classes': COLLAPSE_CLASSES,
+ 'fields': ('parent',)
+ }),
+ )
+ form=FileAdminForm
+ list_display=('slug', 'mimetype', 'path', 'file',)
+
+
+class PageAdmin(NodeAdmin):
+ add_form_template = 'admin/philo/page/add_form.html'