Private
Public Access
1
0

started registration form processing on OTW events - not working yet

This commit is contained in:
Sander Roosendaal
2020-05-27 08:30:34 +02:00
parent 5952e85694
commit 11685f3126
3 changed files with 42 additions and 6 deletions

View File

@@ -1631,6 +1631,40 @@ def virtualevent_register_view(request,id=0):
if sex == 'not specified':
sex = 'male'
coursestandard = None
referencespeed = 5.0
if race.coursestandards is not None:
coursestandard = cd['entrycategory']
referencespeed = coursestandard.referencespeed
boattype = coursestandard.boattype
boatclass = coursestandard.boatclass
weightcategory = coursestandard.weightcategory
adaptiveclass = coursestandard.adaptiveclass
skillclass = coursestandard.skillclass
returnurl = reverse(virtualevent_register_view,
kwargs={'id':race.id})
if age < coursestandard.agemin:
messages.error(request,'You are younger than the minimum age for this group')
return HttpResponseRedirect(url)
if age > coursestandard.agemax:
messages.error(request,'You are older than the maximum age for this group')
return HttpResponseRedirect(url)
if sex == 'male' and coursestandard.sex != 'male':
messages.error(request,'Men are not allowed to enter this category')
return HttpResponseRedirect(url)
if sex == 'mixed' and coursestandard.sex not in ['mixed','male']:
messages.error(request,'Mixed crews are not allowed to enter this category')
return HttpResponseRedirect(url)
record = VirtualRaceResult(
userid=r.id,
teamname=teamname,
@@ -1646,7 +1680,8 @@ def virtualevent_register_view(request,id=0):
boattype=boattype,
coursecompleted=False,
sex=sex,
age=age
age=age,
entrycategory=coursestandard,
)
record.save()