-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathadmin.py
executable file
·50 lines (43 loc) · 1.43 KB
/
admin.py
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
40
41
42
43
44
45
46
47
48
49
50
from __future__ import unicode_literals
from django.contrib import admin
from events.models import Event, Location, Category, Tag, Cancellation
class CancellationInline(admin.TabularInline):
model = Cancellation
extra = 0
class EventAdmin(admin.ModelAdmin):
fieldsets = (
(None, {
'fields': ('start_date', 'end_date', 'all_day', 'repeat',
'end_repeat', 'title', 'description', 'url', 'twitter_url', 'facebook_url', 'register_url',
'created_by',)
}),
('Location', {
'classes': ('collapse',),
'fields': ('location',)
}),
('Category', {
'classes': ('collapse',),
'fields': ('categories',)
}),
('Tag', {
'classes': ('collapse',),
'fields': ('tags',)
}),
('Color', {
'classes': ('collapse',),
'fields': (
('background_color', 'background_color_custom'),
('font_color', 'font_color_custom'),
)
}),
)
list_display = ('title', 'start_date', 'end_date', 'repeat', 'end_repeat')
list_filter = ['start_date']
search_fields = ['title']
date_hierarchy = 'start_date'
inlines = [CancellationInline]
admin.site.register(Event, EventAdmin)
admin.site.register(Location)
admin.site.register(Category)
admin.site.register(Tag)
admin.site.register(Cancellation)