some refinements
This commit is contained in:
@@ -292,11 +292,11 @@ def standard_view(request,id=0):
|
||||
if orderby is not None:
|
||||
standards = CourseStandard.objects.filter(
|
||||
standardcollection=collection
|
||||
).order_by(orderby,"-coursestandard","agemax","agemin","sex","name")
|
||||
).order_by(orderby,"-referencespeed","agemax","agemin","sex","name")
|
||||
else:
|
||||
standards = CourseStandard.objects.filter(
|
||||
standardcollection=collection
|
||||
).order_by("-coursestandard","agemax","agemin","sex","name")
|
||||
).order_by("-referencespeed","agemax","agemin","sex","name")
|
||||
|
||||
breadcrumbs = [
|
||||
{
|
||||
@@ -1596,6 +1596,11 @@ def virtualevent_register_view(request,id=0):
|
||||
except VirtualRace.DoesNotExist:
|
||||
raise Http404("Virtual Challenge does not exist")
|
||||
|
||||
categories = None
|
||||
if race.coursestandards is not None:
|
||||
categories = CourseStandard.objects.filter(
|
||||
standardcollection=race.coursestandards).order_by("name")
|
||||
|
||||
if not race_can_register(r,race):
|
||||
messages.error(request,"You cannot register for this race")
|
||||
|
||||
@@ -1609,7 +1614,7 @@ def virtualevent_register_view(request,id=0):
|
||||
# we're still here
|
||||
if request.method == 'POST':
|
||||
# process form
|
||||
form = VirtualRaceResultForm(request.POST)
|
||||
form = VirtualRaceResultForm(request.POST,categories=categories)
|
||||
if form.is_valid():
|
||||
cd = form.cleaned_data
|
||||
teamname = cd['teamname']
|
||||
@@ -1640,7 +1645,7 @@ def virtualevent_register_view(request,id=0):
|
||||
referencespeed = coursestandard.referencespeed
|
||||
boattype = coursestandard.boattype
|
||||
boatclass = coursestandard.boatclass
|
||||
weightcategory = coursestandard.weightcategory
|
||||
weightcategory = coursestandard.weightclass
|
||||
adaptiveclass = coursestandard.adaptiveclass
|
||||
skillclass = coursestandard.skillclass
|
||||
|
||||
@@ -1649,19 +1654,19 @@ def virtualevent_register_view(request,id=0):
|
||||
|
||||
if age < coursestandard.agemin:
|
||||
messages.error(request,'You are younger than the minimum age for this group')
|
||||
return HttpResponseRedirect(url)
|
||||
return HttpResponseRedirect(returnurl)
|
||||
|
||||
if age > coursestandard.agemax:
|
||||
messages.error(request,'You are older than the maximum age for this group')
|
||||
return HttpResponseRedirect(url)
|
||||
return HttpResponseRedirect(returnurl)
|
||||
|
||||
if sex == 'male' and coursestandard.sex != 'male':
|
||||
messages.error(request,'Men are not allowed to enter this category')
|
||||
return HttpResponseRedirect(url)
|
||||
return HttpResponseRedirect(returnurl)
|
||||
|
||||
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)
|
||||
return HttpResponseRedirect(returnurl)
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user