1 from django.contrib import admin
2 from philo.admin import EntityAdmin, COLLAPSE_CLASSES
3 from philo.contrib.julian.models import Location, Event, Calendar, CalendarView
6 class LocationAdmin(EntityAdmin):
10 class EventAdmin(EntityAdmin):
13 'fields': ('name', 'slug', 'description', 'tags', 'owner')
16 'fields': ('location_content_type', 'location_pk')
19 'fields': (('start_date', 'start_time'), ('end_date', 'end_time'),),
22 'fields': ('parent_event', 'site',),
23 'classes': COLLAPSE_CLASSES
26 filter_horizontal = ['tags']
27 raw_id_fields = ['parent_event']
28 related_lookup_fields = {
30 'generic': [["location_content_type", "location_pk"]]
32 prepopulated_fields = {'slug': ('name',)}
35 class CalendarAdmin(EntityAdmin):
36 prepopulated_fields = {'slug': ('name',)}
37 filter_horizontal = ['events']
40 'fields': ('name', 'description', 'events')
43 'fields': ('slug', 'site', 'language',),
44 'classes': COLLAPSE_CLASSES
49 class CalendarViewAdmin(EntityAdmin):
52 'fields': ('calendar',)
55 'fields': ('index_page', 'event_detail_page')
57 ('General Settings', {
58 'fields': ('tag_permalink_base', 'owner_permalink_base', 'location_permalink_base', 'events_per_page')
60 ('Event List Pages', {
61 'fields': ('timespan_page', 'tag_page', 'location_page', 'owner_page'),
62 'classes': COLLAPSE_CLASSES
65 'fields': ('location_archive_page', 'tag_archive_page', 'owner_archive_page'),
66 'classes': COLLAPSE_CLASSES
69 'fields': ( 'feeds_enabled', 'feed_suffix', 'feed_type', 'item_title_template', 'item_description_template',),
70 'classes': COLLAPSE_CLASSES
73 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',)
74 related_lookup_fields = {'fk': raw_id_fields}
77 admin.site.register(Location, LocationAdmin)
78 admin.site.register(Event, EventAdmin)
79 admin.site.register(Calendar, CalendarAdmin)
80 admin.site.register(CalendarView, CalendarViewAdmin)