X-Git-Url: http://git.ithinksw.org/philo.git/blobdiff_plain/f9377788444b280c32dc7004f0a04b131bb74e14..3be0713303de6ba83335a530894d75b86027e042:/admin.py diff --git a/admin.py b/admin.py index 61a1fb8..0f34028 100644 --- a/admin.py +++ b/admin.py @@ -12,6 +12,9 @@ from django.core.exceptions import ValidationError, ObjectDoesNotExist from validators import TreeParentValidator, TreePositionValidator +COLLAPSE_CLASSES = ('collapse', 'collapse-closed', 'closed',) + + class AttributeInline(generic.GenericTabularInline): ct_field = 'entity_content_type' ct_fk_field = 'entity_object_id' @@ -39,7 +42,7 @@ class CollectionMemberInline(admin.TabularInline): fk_name = 'collection' model = CollectionMember extra = 1 - classes = ('collapse-closed',) + classes = COLLAPSE_CLASSES allow_add = True fields = ('member_content_type', 'member_object_id', 'index',) @@ -91,14 +94,14 @@ class TemplateAdmin(admin.ModelAdmin): 'fields': ('parent', 'name', 'slug') }), ('Documentation', { - 'classes': ('collapse', 'collapse-closed'), + 'classes': COLLAPSE_CLASSES, 'fields': ('documentation',) }), (None, { 'fields': ('code',) }), ('Advanced', { - 'classes': ('collapse','collapse-closed'), + 'classes': COLLAPSE_CLASSES, 'fields': ('mimetype',) }), ) @@ -168,7 +171,7 @@ class RedirectAdmin(NodeAdmin): 'fields': ('slug', 'target', 'status_code') }), ('URL/Tree/Hierarchy', { - 'classes': ('collapse', 'collapse-closed'), + 'classes': COLLAPSE_CLASSES, 'fields': ('parent',) }), ) @@ -184,7 +187,7 @@ class FileAdmin(NodeAdmin): 'fields': ('file', 'slug', 'mimetype') }), ('URL/Tree/Hierarchy', { - 'classes': ('collapse', 'collapse-closed'), + 'classes': COLLAPSE_CLASSES, 'fields': ('parent',) }), ) @@ -200,7 +203,7 @@ class PageAdmin(NodeAdmin): 'fields': ('title', 'slug', 'template') }), ('URL/Tree/Hierarchy', { - 'classes': ('collapse', 'collapse-closed'), + 'classes': COLLAPSE_CLASSES, 'fields': ('parent',) }), ) @@ -278,6 +281,17 @@ class PageAdmin(NodeAdmin): contentreference.save() +class RedirectAdmin(admin.ModelAdmin): + list_display=('slug', 'target', 'path', 'status_code',) + list_filter=('status_code',) + form = RedirectAdminForm + + +class FileAdmin(admin.ModelAdmin): + form=FileAdminForm + list_display=('slug', 'mimetype', 'path', 'file',) + + admin.site.register(Collection, CollectionAdmin) admin.site.register(Redirect, RedirectAdmin) admin.site.register(File, FileAdmin)