Add special registration type that includes cfp team members
authorMagnus Hagander <magnus@hagander.net>
Thu, 23 Jan 2025 19:00:53 +0000 (20:00 +0100)
committerMagnus Hagander <magnus@hagander.net>
Thu, 23 Jan 2025 19:00:53 +0000 (20:00 +0100)
Since we have the list of actual user accounts used for talkvoters, we
can trivially create a special registration type that lets those people
register automatically, without having to deal with vouchers etc.

docs/confreg/registrations.md
postgresqleu/confreg/migrations/0007_new_specialtype.py
postgresqleu/confreg/regtypes.py

index 913efb9f9c76cc6fd80b119f368bd9dc009228ae..daaada0c45ab07d19fb21c7094644706877621cf 100644 (file)
@@ -121,6 +121,10 @@ Confirmed staff
 : The attendee registering must use one of the accounts that
 are listed as staff in the [conference configuration](configuring).
 
+CFP team member
+: The attendee registering must use one of the accounts that
+are listed as talkvoter in the [conference configuration](configuring).
+
 Must have voucher
 : The registration must be done using a voucher. Vouchers in turn are tied to
   a specific registration type, so using this makes it possible to say only
index 8d8f3c3f71d1aff6a97a7996c9976e57143d60e1..929cd546e10d098760bbc2c01a685e1e35ba532c 100644 (file)
@@ -14,6 +14,6 @@ class Migration(migrations.Migration):
         migrations.AlterField(
             model_name='registrationtype',
             name='specialtype',
-            field=models.CharField(blank=True, choices=[('man', 'Manually confirmed'), ('spk', 'Confirmed speaker'), ('spkr', 'Confirmed or reserve speaker'), ('staff', 'Confirmed staff'), ('vch', 'Requires specific voucher')], max_length=5, null=True, verbose_name='Special type'),
+            field=models.CharField(blank=True, choices=[('cfp', 'CFP team member'), ('man', 'Manually confirmed'), ('spk', 'Confirmed speaker'), ('spkr', 'Confirmed or reserve speaker'), ('staff', 'Confirmed staff'), ('vch', 'Requires specific voucher')], max_length=5, null=True, verbose_name='Special type'),
         ),
     ]
index 2359d1f9dc888651c02265c6c0e6d913731a1690..2132e72d9ec4d5e789fabc31501b3c72db82a61d 100644 (file)
@@ -60,6 +60,19 @@ _specialregtypes['staff'] = {
     }
 
 
+def validate_cfpmember_registration(reg):
+    if reg.attendee is None:
+        raise ValidationError('CFP team member registrations have to be done by the attendee directly')
+    if not reg.conference.talkvoters.filter(pk=reg.attendee.pk).exists():
+        raise ValidationError('This registration type is only available if you are confirmed CFP team member at this conference')
+
+
+_specialregtypes['cfp'] = {
+    'name': 'CFP team member',
+    'func': validate_cfpmember_registration,
+    }
+
+
 def validate_manual_registration(reg):
     # Always validates so we can save the record, and then we just block
     # it at confirmation. This doesn't work well with multiregs, so just