1 from django.contrib import admin
3 from philo.admin import EntityAdmin, COLLAPSE_CLASSES
4 from philo.contrib.julian.models import Location, Event, Calendar, CalendarView
7 class LocationAdmin(EntityAdmin):
11 class EventAdmin(EntityAdmin):
14 'fields': ('name', 'slug', 'description', 'tags', 'owner')
17 'fields': ('location_content_type', 'location_pk')
20 'fields': (('start_date', 'start_time'), ('end_date', 'end_time'),),
23 'fields': ('parent_event', 'site',),
24 'classes': COLLAPSE_CLASSES
27 filter_horizontal = ['tags']
28 raw_id_fields = ['parent_event']
29 related_lookup_fields = {
31 'generic': [["location_content_type", "location_pk"]]
33 prepopulated_fields = {'slug': ('name',)}
36 class CalendarAdmin(EntityAdmin):
37 prepopulated_fields = {'slug': ('name',)}
38 filter_horizontal = ['events']
41 'fields': ('name', 'description', 'events')
44 'fields': ('slug', 'site', 'language',),
45 'classes': COLLAPSE_CLASSES
50 class CalendarViewAdmin(EntityAdmin):
53 'fields': ('calendar',)
56 'fields': ('index_page', 'event_detail_page')
58 ('General Settings', {
59 'fields': ('tag_permalink_base', 'owner_permalink_base', 'location_permalink_base', 'events_per_page')
61 ('Event List Pages', {
62 'fields': ('timespan_page', 'tag_page', 'location_page', 'owner_page'),
63 'classes': COLLAPSE_CLASSES
66 'fields': ('location_archive_page', 'tag_archive_page', 'owner_archive_page'),
67 'classes': COLLAPSE_CLASSES
70 'fields': ( 'feeds_enabled', 'feed_suffix', 'feed_type', 'item_title_template', 'item_description_template',),
71 'classes': COLLAPSE_CLASSES
74 raw_id_fields = ('index_page', 'event_detail_page', 'timespan_page', 'tag_page', 'location_page', 'owner_page', 'location_archive_page', 'tag_archive_page', 'owner_archive_page', 'item_title_template', 'item_description_template',)
75 related_lookup_fields = {'fk': raw_id_fields}
78 admin.site.register(Location, LocationAdmin)
79 admin.site.register(Event, EventAdmin)
80 admin.site.register(Calendar, CalendarAdmin)
81 admin.site.register(CalendarView, CalendarViewAdmin)