admin for event

This commit is contained in:
Qwann 2018-08-20 18:20:18 +02:00
parent 0ff2f40832
commit 5d39b1018b

View file

@ -27,20 +27,59 @@ class ActivityTagAdmin(admin.ModelAdmin):
list_filter = ['event', 'is_public', ] list_filter = ['event', 'is_public', ]
class AbstractActivityTemplateAdmin(admin.ModelAdmin): class ActivityTemplateAdmin(admin.ModelAdmin):
list_display = ['title', 'event', 'is_public', ] list_display = ['name', 'title', 'event', 'is_public', ]
ordering = ['title', 'event', 'has_perm', ] ordering = ['name', 'title', 'event', 'has_perm', ]
search_fields = ['name', 'title', 'description', 'remark', ]
list_filter = ['event', 'is_public', 'has_perm', 'tags', ]
filter_horizontal = ['tags', 'places', ]
fieldsets = (
('Identifiant', {
'fields': ('name', ),
}),
('Général', {
'fields': ('event', 'title', 'is_public', 'places', ),
'description': "Tous ces champs sont héritables (Sauf Évènement)",
}),
('Permanences', {
'fields': ('has_perm', ('min_perm', 'max_perm', ), ),
'classes': ('collapse',),
'description': "Tous ces champs sont héritables",
}),
('Descriptions', {
'fields': ('description', 'tags', 'remarks', ),
'classes': ('collapse',),
'description': "Tous ces champs sont héritables",
}),
)
class ActivityAdmin(admin.ModelAdmin):
list_display = ['title', 'event', 'is_public', 'parent', ]
ordering = ['title', 'event', 'has_perm', 'parent', ]
search_fields = ['title', 'description', 'remark', ] search_fields = ['title', 'description', 'remark', ]
list_filter = ['event', 'is_public', 'has_perm', 'tags', ] list_filter = ['event', 'is_public', 'has_perm', 'tags', ]
filter_horizontal = ['tags', 'places', ]
fieldsets = (
class ActivityTemplateAdmin(AbstractActivityTemplateAdmin): ('Général', {
pass 'fields': ('event', 'parent', 'title', 'is_public', 'places', ),
'description': "Tous ces champs sont héritables (sauf parent et Évènement)",
}),
class ActivityAdmin(AbstractActivityTemplateAdmin): ('Champs non-héritables', {
pass 'fields': ('parent', ),
#exclude = ['parent', ] # TODO remove me 'description': "Tous ces champs doivent être spécifiés",
}),
('Permanences', {
'fields': ('has_perm', ('min_perm', 'max_perm', ), ),
'classes': ('collapse',),
'description': "Tous ces champs sont héritables (sauf les gens en perm)",
}),
('Descriptions', {
'fields': ('description', 'tags', 'remarks', 'staff', ),
'classes': ('collapse',),
'description': "Tous ces champs sont héritables",
}),
)
admin_site.register(Event, EventAdmin) admin_site.register(Event, EventAdmin)