From 5dfea2b1e03c8424e1f2ffff4caad37f63fe6818 Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Thu, 23 Jan 2025 20:00:53 +0100 Subject: [PATCH] Add special registration type that includes cfp team members 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 | 4 ++++ .../confreg/migrations/0007_new_specialtype.py | 2 +- postgresqleu/confreg/regtypes.py | 13 +++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/docs/confreg/registrations.md b/docs/confreg/registrations.md index 913efb9f..daaada0c 100644 --- a/docs/confreg/registrations.md +++ b/docs/confreg/registrations.md @@ -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 diff --git a/postgresqleu/confreg/migrations/0007_new_specialtype.py b/postgresqleu/confreg/migrations/0007_new_specialtype.py index 8d8f3c3f..929cd546 100644 --- a/postgresqleu/confreg/migrations/0007_new_specialtype.py +++ b/postgresqleu/confreg/migrations/0007_new_specialtype.py @@ -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'), ), ] diff --git a/postgresqleu/confreg/regtypes.py b/postgresqleu/confreg/regtypes.py index 2359d1f9..2132e72d 100644 --- a/postgresqleu/confreg/regtypes.py +++ b/postgresqleu/confreg/regtypes.py @@ -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 -- 2.39.5