Show slot lengths when editing schedule and volunteer slots master github/master
authorMagnus Hagander <magnus@hagander.net>
Wed, 17 Dec 2025 09:55:51 +0000 (10:55 +0100)
committerMagnus Hagander <magnus@hagander.net>
Wed, 17 Dec 2025 09:57:44 +0000 (10:57 +0100)
postgresqleu/confreg/backendforms.py

index 8a05714cdb723bd5bd5c7237876150f34cb91985..6bb60ac2f18d5e298de10bf1c3150f2d54970211 100644 (file)
@@ -1189,9 +1189,15 @@ class BackendConferenceSpeakerForm(BackendGlobalSpeakerForm):
 
 class BackendConferenceSessionSlotForm(BackendForm):
     helplink = 'schedule#slots'
 
 class BackendConferenceSessionSlotForm(BackendForm):
     helplink = 'schedule#slots'
-    list_fields = ['starttime', 'endtime', ]
+    list_fields = ['starttime', 'endtime', 'slotlength', ]
     allow_copy_previous = True
     copy_transform_form = BackendTransformConferenceDateTimeForm
     allow_copy_previous = True
     copy_transform_form = BackendTransformConferenceDateTimeForm
+    verbose_field_names = {
+        'slotlength': 'Slot length',
+    }
+    queryset_extra_fields = {
+        'slotlength': 'endtime - starttime',
+    }
 
     class Meta:
         model = ConferenceSessionScheduleSlot
 
     class Meta:
         model = ConferenceSessionScheduleSlot
@@ -1243,9 +1249,15 @@ class BackendMergeSpeakerForm(django.forms.Form):
 
 class BackendVolunteerSlotForm(BackendForm):
     helplink = 'volunteers#slots'
 
 class BackendVolunteerSlotForm(BackendForm):
     helplink = 'volunteers#slots'
-    list_fields = ['timerange', 'title', 'min_staff', 'max_staff', ]
+    list_fields = ['timerange', 'slotlength', 'title', 'min_staff', 'max_staff', ]
     allow_copy_previous = True
     copy_transform_form = BackendTransformConferenceDateTimeForm
     allow_copy_previous = True
     copy_transform_form = BackendTransformConferenceDateTimeForm
+    verbose_field_names = {
+        'slotlength': 'Slot length',
+    }
+    queryset_extra_fields = {
+        'slotlength': 'upper(timerange)-lower(timerange)',
+    }
 
     class Meta:
         model = VolunteerSlot
 
     class Meta:
         model = VolunteerSlot