Add admin action to update slot names
* The slot object updates its name every time it is saved * But sometimes its slotrooms are changed underneath it, and so the name can become out of date * This method is a simple way of updating the names for all the slots
This commit is contained in:
parent
9a25ca1754
commit
f99765ca0b
1 changed files with 8 additions and 1 deletions
9
vendor/symposion/schedule/admin.py
vendored
9
vendor/symposion/schedule/admin.py
vendored
|
@ -25,12 +25,19 @@ class SlotRoomInline(admin.TabularInline):
|
|||
extra = 1
|
||||
|
||||
|
||||
def update_slot_names(modeladmin, request, queryset):
|
||||
for slot in queryset:
|
||||
slot.save()
|
||||
update_slot_names.short_description = "Update slot names"
|
||||
|
||||
|
||||
class SlotAdmin(admin.ModelAdmin):
|
||||
list_filter = ("day", "kind","exclusive","slotroom__room")
|
||||
list_display = ("day", "start", "end", "kind", "room_names",
|
||||
"content_override","exclusive")
|
||||
list_editable = ("exclusive",)
|
||||
list_editable = ("exclusive","kind","start","end")
|
||||
inlines = [SlotRoomInline]
|
||||
actions = [update_slot_names]
|
||||
|
||||
def room_names(self, slot):
|
||||
return ", ".join(room.name for room in slot.rooms.all())
|
||||
|
|
Loading…
Reference in a new issue