change default required helpers to 1, even in import, so locations can be changed

This commit is contained in:
xAndy 2025-05-17 22:32:10 +02:00 committed by Luca
parent ce8316a69c
commit 04d85811fe
2 changed files with 2 additions and 4 deletions

View File

@ -20,7 +20,7 @@ class ShiftInline(admin.TabularInline):
@admin.register(Room)
class RoomAdmin(admin.ModelAdmin):
list_display = ("name", "description_length", "shift_count")
list_display = ("name", "description_length", "shift_count", "required_helpers")
inlines = [ShiftInline]
def description_length(self, object):

View File

@ -89,9 +89,7 @@ def import_calendar(calendar):
rooms[r.name] = r
for room, r in rooms.items():
if r == None:
rooms[room] = Room(
name=room, required_helpers=0
) # required_helpers=0 ensures a shift in a new room is not displayed unless the correct number of required helpers is set or the shift itself specifies it
rooms[room] = Room(name=room)
rooms[room].save()
for e in Event.objects.filter(calendar=calendar, uuid__in=events):