mirror of
https://github.com/pretix/pretix.git
synced 2026-05-06 15:24:02 +00:00
Waiting list: Optionally allow multiple entries per email (#3277)
Co-authored-by: Richard Schreiber <schreiber@rami.io>
This commit is contained in:
@@ -119,7 +119,7 @@ class WaitingListEntry(LoggedModel):
|
||||
|
||||
def clean(self):
|
||||
try:
|
||||
WaitingListEntry.clean_duplicate(self.email, self.item, self.variation, self.subevent, self.pk)
|
||||
WaitingListEntry.clean_duplicate(self.event, self.email, self.item, self.variation, self.subevent, self.pk)
|
||||
WaitingListEntry.clean_itemvar(self.event, self.item, self.variation)
|
||||
WaitingListEntry.clean_subevent(self.event, self.subevent)
|
||||
except ObjectDoesNotExist:
|
||||
@@ -308,9 +308,9 @@ class WaitingListEntry(LoggedModel):
|
||||
raise ValidationError(_('The subevent does not belong to this event.'))
|
||||
|
||||
@staticmethod
|
||||
def clean_duplicate(email, item, variation, subevent, pk):
|
||||
def clean_duplicate(event, email, item, variation, subevent, pk):
|
||||
if WaitingListEntry.objects.filter(
|
||||
item=item, variation=variation, email__iexact=email, voucher__isnull=True, subevent=subevent
|
||||
).exclude(pk=pk).exists():
|
||||
).exclude(pk=pk).count() >= event.settings.waiting_list_limit_per_user:
|
||||
raise ValidationError(_('You are already on this waiting list! We will notify '
|
||||
'you as soon as we have a ticket available for you.'))
|
||||
|
||||
@@ -1330,6 +1330,21 @@ DEFAULTS = {
|
||||
help_text=_("If you ask for a phone number, explain why you do so and what you will use the phone number for.")
|
||||
)
|
||||
},
|
||||
'waiting_list_limit_per_user': {
|
||||
'default': '1',
|
||||
'type': int,
|
||||
'serializer_class': serializers.IntegerField,
|
||||
'form_class': forms.IntegerField,
|
||||
'serializer_kwargs': dict(
|
||||
min_value=1,
|
||||
),
|
||||
'form_kwargs': dict(
|
||||
label=_("Maximum number of entries per email address for the same product"),
|
||||
min_value=1,
|
||||
required=True,
|
||||
widget=forms.NumberInput(),
|
||||
)
|
||||
},
|
||||
'show_checkin_number_user': {
|
||||
'default': 'False',
|
||||
'type': bool,
|
||||
|
||||
Reference in New Issue
Block a user