-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathadmin.py
37 lines (29 loc) · 1.06 KB
/
admin.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from django.contrib import admin
from treebeard.admin import TreeAdmin
from treebeard.forms import movenodeform_factory
from document_index.models import GroupTreeList, Group, Document, Source
class SourceInline(admin.TabularInline):
model = Source
extra = 1
fieldsets = [
(None, {'fields': ['name', 'description', 'filename', 'mime_type',
'comment']}),
]
class DocumentAdmin(admin.ModelAdmin):
fieldsets = [
(None, {'fields': ['group', 'name', 'description', 'comment']}),
]
inlines = [SourceInline]
list_display = ('name', 'description', 'created')
list_filter = ['created']
search_fields = ['description']
class GroupAdmin(TreeAdmin):
form = movenodeform_factory(Group)
#fields = ['tree', 'owner', 'name'] #, 'description', 'comment']
#exclude = ['owner']
list_filter = ('owner',)
# def save_model(self, request, obj, form, change):
# obj.save()
admin.site.register(Document, DocumentAdmin)
admin.site.register(Group, GroupAdmin)
admin.site.register(GroupTreeList)