registration deadline cannot be in the past
This commit is contained in:
@@ -1394,9 +1394,9 @@ class VirtualRaceForm(ModelForm):
|
|||||||
enddatetime
|
enddatetime
|
||||||
)
|
)
|
||||||
|
|
||||||
|
registration_closure = cd['registration_closure']
|
||||||
|
|
||||||
if startdatetime > enddatetime:
|
registration_form = cd['registration_form']
|
||||||
raise forms.ValidationError("The Start of the Race Window should be before the End of the Race Window")
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
evaluation_closure = cd['evaluation_closure']
|
evaluation_closure = cd['evaluation_closure']
|
||||||
@@ -1404,6 +1404,31 @@ class VirtualRaceForm(ModelForm):
|
|||||||
evaluation_closure = enddatetime+datetime.timedelta(days=1)
|
evaluation_closure = enddatetime+datetime.timedelta(days=1)
|
||||||
cd['evaluation_closure'] = evaluation_closure
|
cd['evaluation_closure'] = evaluation_closure
|
||||||
|
|
||||||
|
if registration_form == 'manual':
|
||||||
|
try:
|
||||||
|
registration_closure = pytz.timezone(
|
||||||
|
timezone_str
|
||||||
|
).localize(
|
||||||
|
registration_closure.replace(tzinfo=None)
|
||||||
|
)
|
||||||
|
except AttributeError:
|
||||||
|
registration_closure = startdatetime
|
||||||
|
elif registration_form == 'windowstart':
|
||||||
|
registration_closure = startdatetime
|
||||||
|
elif registration_form == 'windowend':
|
||||||
|
registration_closure = enddatetime
|
||||||
|
else:
|
||||||
|
registration_closure = evaluation_closure
|
||||||
|
|
||||||
|
|
||||||
|
if registration_closure <= timezone.now():
|
||||||
|
raise forms.ValidationError("Registration Closure cannot be in the past")
|
||||||
|
|
||||||
|
|
||||||
|
if startdatetime > enddatetime:
|
||||||
|
raise forms.ValidationError("The Start of the Race Window should be before the End of the Race Window")
|
||||||
|
|
||||||
|
|
||||||
if cd['evaluation_closure'] <= enddatetime:
|
if cd['evaluation_closure'] <= enddatetime:
|
||||||
raise forms.ValidationError("Evaluation closure deadline should be after the Race Window closes")
|
raise forms.ValidationError("Evaluation closure deadline should be after the Race Window closes")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user