event admin base
This commit is contained in:
parent
7064e89059
commit
e6d79df735
1 changed files with 37 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from shared.admin import admin_site
|
from shared.admin import admin_site
|
||||||
|
|
||||||
from .models import Event
|
from .models import Event, Place, ActivityTag, Activity, ActivityTemplate # TODO add me
|
||||||
|
|
||||||
|
|
||||||
class EventAdmin(admin.ModelAdmin):
|
class EventAdmin(admin.ModelAdmin):
|
||||||
|
@ -9,6 +9,42 @@ class EventAdmin(admin.ModelAdmin):
|
||||||
readonly_fields = ['created_by', 'created_at', ]
|
readonly_fields = ['created_by', 'created_at', ]
|
||||||
ordering = ['title', 'beginning_date', 'ending_date', ]
|
ordering = ['title', 'beginning_date', 'ending_date', ]
|
||||||
search_fields = ['title', 'decription', ]
|
search_fields = ['title', 'decription', ]
|
||||||
|
list_filter = ['beginning_date', 'ending_date', ]
|
||||||
date_hierarchy = 'beginning_date'
|
date_hierarchy = 'beginning_date'
|
||||||
|
|
||||||
|
|
||||||
|
class PlaceAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ['name', 'event', ]
|
||||||
|
ordering = ['name', 'event', ]
|
||||||
|
search_fields = ['name', ]
|
||||||
|
list_filter = ['event', ]
|
||||||
|
|
||||||
|
|
||||||
|
class ActivityTagAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ['name', 'event', 'is_public', ]
|
||||||
|
ordering = ['name', 'event', 'is_public', ]
|
||||||
|
search_fields = ['name', ]
|
||||||
|
list_filter = ['event', 'is_public', ]
|
||||||
|
|
||||||
|
|
||||||
|
class AbstractActivityTemplateAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ['title', 'event', 'is_public', ]
|
||||||
|
ordering = ['title', 'event', 'has_perm', ]
|
||||||
|
search_fields = ['title', 'description', 'remark', ]
|
||||||
|
list_filter = ['event', 'is_public', 'has_perm', 'tags', ]
|
||||||
|
|
||||||
|
|
||||||
|
class ActivityTemplateAdmin(AbstractActivityTemplateAdmin):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class ActivityAdmin(AbstractActivityTemplateAdmin):
|
||||||
|
pass
|
||||||
|
#exclude = ['parent', ] # TODO remove me
|
||||||
|
|
||||||
|
|
||||||
admin_site.register(Event, EventAdmin)
|
admin_site.register(Event, EventAdmin)
|
||||||
|
admin_site.register(Place, PlaceAdmin)
|
||||||
|
admin_site.register(ActivityTag, ActivityTagAdmin)
|
||||||
|
admin_site.register(ActivityTemplate, ActivityTemplateAdmin)
|
||||||
|
admin_site.register(Activity, ActivityAdmin)
|
||||||
|
|
Loading…
Reference in a new issue