1 from django.contrib import admin
2 from philo.admin.base import EntityAdmin, TreeEntityAdmin, COLLAPSE_CLASSES
3 from philo.models import Node, Redirect, File
6 class NodeAdmin(TreeEntityAdmin):
7 list_display = ('slug', 'view', 'accepts_subpath')
8 related_lookup_fields = {
11 'generic': [['view_content_type', 'view_object_id']]
14 def accepts_subpath(self, obj):
15 return obj.accepts_subpath
16 accepts_subpath.boolean = True
19 class ViewAdmin(EntityAdmin):
23 class RedirectAdmin(ViewAdmin):
26 'fields': ('target_node', 'url_or_subpath', 'status_code')
29 'fields': ('reversing_parameters',),
30 'classes': COLLAPSE_CLASSES
33 list_display = ('target_url', 'status_code', 'target_node', 'url_or_subpath')
34 list_filter = ('status_code',)
35 raw_id_fields = ['target_node']
36 related_lookup_fields = {
41 class FileAdmin(ViewAdmin):
44 'fields': ('file', 'mimetype')
47 list_display = ('mimetype', 'file')
50 admin.site.register(Node, NodeAdmin)
51 admin.site.register(Redirect, RedirectAdmin)
52 admin.site.register(File, FileAdmin)