forked from nathanborror/django-basic-apps
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.py
More file actions
39 lines (29 loc) · 976 Bytes
/
Copy pathadmin.py
File metadata and controls
39 lines (29 loc) · 976 Bytes
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
38
39
from django.contrib import admin
from basic.groups.models import *
class GroupMemberInline(admin.TabularInline):
raw_id_fields = ('user',)
model = GroupMember
fk = 'group'
class GroupMessageInline(admin.TabularInline):
raw_id_fields = ('user',)
model = GroupMessage
fk = 'topic'
class GroupPageInline(admin.TabularInline):
model = GroupPage
fk = 'group'
class GroupAdmin(admin.ModelAdmin):
prepopulated_fields = {'slug': ('title',)}
raw_id_fields = ('creator',)
inlines = (
GroupPageInline,
GroupMemberInline
)
admin.site.register(Group, GroupAdmin)
class GroupTopicAdmin(admin.ModelAdmin):
raw_id_fields = ('user', 'group')
inlines = (GroupMessageInline,)
admin.site.register(GroupTopic, GroupTopicAdmin)
class GroupMemberAdmin(admin.ModelAdmin):
raw_id_fields = ('user', 'group')
list_display = ('user', 'group', 'status', 'created')
admin.site.register(GroupMember, GroupMemberAdmin)