2016-07-13 17:13:47 +00:00
|
|
|
from django.contrib import admin
|
|
|
|
|
2016-07-13 19:44:09 +00:00
|
|
|
from .models import Event, Speaker, EventType
|
|
|
|
|
|
|
|
|
|
|
|
@admin.register(EventType)
|
|
|
|
class EventTypeAdmin(admin.ModelAdmin):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
2016-08-04 21:03:39 +00:00
|
|
|
@admin.register(Speaker)
|
|
|
|
class SpeakerAdmin(admin.ModelAdmin):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class SpeakerInline(admin.StackedInline):
|
|
|
|
model = Speaker.events.through
|
|
|
|
|
|
|
|
|
2016-07-13 19:44:09 +00:00
|
|
|
@admin.register(Event)
|
|
|
|
class EventAdmin(admin.ModelAdmin):
|
2016-07-13 20:37:20 +00:00
|
|
|
list_display = [
|
|
|
|
'title',
|
|
|
|
'event_type',
|
|
|
|
'get_days',
|
|
|
|
'start',
|
2016-08-04 21:03:39 +00:00
|
|
|
'end',
|
2016-07-13 20:37:20 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
def get_days(self, obj):
|
|
|
|
return ', '.join([
|
|
|
|
str(day.date.strftime('%a'))
|
|
|
|
for day in obj.days.all()
|
|
|
|
])
|
2016-07-13 19:44:09 +00:00
|
|
|
|
2016-08-04 21:03:39 +00:00
|
|
|
inlines = [
|
|
|
|
SpeakerInline
|
|
|
|
]
|
2016-07-13 19:44:09 +00:00
|
|
|
|
|
|
|
|
2016-07-13 17:13:47 +00:00
|
|
|
|