2012-08-31 04:44:59 +00:00
|
|
|
from django.contrib import admin
|
|
|
|
|
2016-12-24 06:55:11 +00:00
|
|
|
from symposion.schedule.models import Schedule, Day, Room, SlotKind, Slot, SlotRoom, Presentation, Session, SessionRole, Track
|
2012-08-31 04:44:59 +00:00
|
|
|
|
|
|
|
|
2015-08-01 03:37:58 +00:00
|
|
|
class DayInline(admin.StackedInline):
|
|
|
|
model = Day
|
|
|
|
extra = 2
|
|
|
|
|
|
|
|
|
|
|
|
class SlotKindInline(admin.StackedInline):
|
|
|
|
model = SlotKind
|
|
|
|
|
|
|
|
|
|
|
|
class ScheduleAdmin(admin.ModelAdmin):
|
|
|
|
model = Schedule
|
|
|
|
inlines = [DayInline, SlotKindInline, ]
|
2017-10-15 05:58:43 +00:00
|
|
|
list_display = ["section","published","hidden"]
|
|
|
|
list_editable = ["published","hidden"]
|
|
|
|
list_filter = ["published","hidden"]
|
2015-08-01 03:37:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
class SlotRoomInline(admin.TabularInline):
|
|
|
|
model = SlotRoom
|
|
|
|
extra = 1
|
|
|
|
|
|
|
|
|
2018-01-10 10:10:52 +00:00
|
|
|
def update_slot_names(modeladmin, request, queryset):
|
|
|
|
for slot in queryset:
|
|
|
|
slot.save()
|
|
|
|
update_slot_names.short_description = "Update slot names"
|
|
|
|
|
|
|
|
|
2015-08-01 03:37:58 +00:00
|
|
|
class SlotAdmin(admin.ModelAdmin):
|
2018-01-10 04:53:43 +00:00
|
|
|
list_filter = ("day", "kind","exclusive","slotroom__room")
|
2017-12-24 02:52:51 +00:00
|
|
|
list_display = ("day", "start", "end", "kind", "room_names",
|
|
|
|
"content_override","exclusive")
|
2018-01-10 10:10:52 +00:00
|
|
|
list_editable = ("exclusive","kind","start","end")
|
2015-09-08 19:51:49 +00:00
|
|
|
inlines = [SlotRoomInline]
|
2018-01-10 10:10:52 +00:00
|
|
|
actions = [update_slot_names]
|
2015-08-01 03:37:58 +00:00
|
|
|
|
2017-12-24 02:52:51 +00:00
|
|
|
def room_names(self, slot):
|
|
|
|
return ", ".join(room.name for room in slot.rooms.all())
|
|
|
|
|
2015-09-14 02:34:40 +00:00
|
|
|
|
2015-08-01 03:37:58 +00:00
|
|
|
class RoomAdmin(admin.ModelAdmin):
|
2015-09-08 19:51:49 +00:00
|
|
|
list_display = ["name", "order", "schedule"]
|
|
|
|
list_filter = ["schedule"]
|
|
|
|
inlines = [SlotRoomInline]
|
2015-08-01 03:37:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
class PresentationAdmin(admin.ModelAdmin):
|
|
|
|
model = Presentation
|
|
|
|
list_filter = ("section", "cancelled", "slot")
|
|
|
|
|
2017-12-03 07:11:39 +00:00
|
|
|
class TrackAdmin(admin.ModelAdmin):
|
|
|
|
model = Track
|
|
|
|
list_filter=("room","day")
|
|
|
|
list_display=("name","room","day")
|
|
|
|
list_editable=("room","day")
|
|
|
|
|
2018-01-10 11:25:34 +00:00
|
|
|
class SessionAdmin(admin.ModelAdmin):
|
|
|
|
model = Session,
|
|
|
|
filter_vertical=["slots"]
|
2015-08-01 03:37:58 +00:00
|
|
|
|
2012-08-31 04:44:59 +00:00
|
|
|
admin.site.register(Day)
|
2015-07-15 21:43:44 +00:00
|
|
|
admin.site.register(
|
|
|
|
SlotKind,
|
2015-09-08 19:51:49 +00:00
|
|
|
list_display=["label", "schedule"],
|
2012-11-25 20:10:30 +00:00
|
|
|
)
|
|
|
|
admin.site.register(
|
|
|
|
SlotRoom,
|
2015-09-08 19:51:49 +00:00
|
|
|
list_display=["slot", "room"]
|
2012-11-25 20:10:30 +00:00
|
|
|
)
|
2015-08-01 03:37:58 +00:00
|
|
|
admin.site.register(Schedule, ScheduleAdmin)
|
|
|
|
admin.site.register(Room, RoomAdmin)
|
|
|
|
admin.site.register(Slot, SlotAdmin)
|
2018-01-10 11:25:34 +00:00
|
|
|
admin.site.register(Session, SessionAdmin)
|
2015-06-15 09:55:54 +00:00
|
|
|
admin.site.register(SessionRole)
|
2015-08-01 03:37:58 +00:00
|
|
|
admin.site.register(Presentation, PresentationAdmin)
|
2017-12-03 07:11:39 +00:00
|
|
|
admin.site.register(Track, TrackAdmin)
|