Add option to ignore quota when extending expired orders

This commit is contained in:
Raphael Michel
2017-10-10 12:40:18 +02:00
parent 645e82fb04
commit bbade75061
3 changed files with 39 additions and 1 deletions

View File

@@ -15,6 +15,13 @@ from pretix.base.services.pricing import get_price
class ExtendForm(I18nModelForm):
quota_ignore = forms.BooleanField(
label=_('Overbook quota'),
help_text=_('If you check this box, this operation will be performed even if it leads to an overbooked quota '
'and you having sold more tickets than you planned!'),
required=False
)
class Meta:
model = Order
fields = ['expires']
@@ -25,6 +32,11 @@ class ExtendForm(I18nModelForm):
})
}
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
if self.instance.status == Order.STATUS_PENDING or self.instance._is_still_available(now(), count_waitinglist=False) is True:
del self.fields['quota_ignore']
def clean(self):
data = super().clean()
data['expires'] = data['expires'].replace(hour=23, minute=59, second=59)