first version of virtualsessions_view - not working
This commit is contained in:
@@ -717,4 +717,21 @@ class PlannedSessionTeamMemberForm(forms.Form):
|
||||
|
||||
self.fields['members'].queryset = thesession.rower.all()
|
||||
|
||||
from rowers.models import VirtualRace,GeoCourse
|
||||
|
||||
def get_countries():
|
||||
countries = VirtualRace.objects.order_by('country').values_list('country').distinct()
|
||||
# countries = GeoCourse.objects.order_by('country').values_list('country').distinct()
|
||||
return countries
|
||||
|
||||
class VirtualRaceSelectForm(forms.Form):
|
||||
country = forms.ChoiceField(
|
||||
label='Country',
|
||||
choices = get_countries()
|
||||
)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(VirtualRaceSelectForm, self).__init__(*args, **kwargs)
|
||||
self.fields['country'] = forms.ChoiceField(
|
||||
choices = get_countries(),
|
||||
)
|
||||
|
||||
@@ -1056,14 +1056,25 @@ class PlannedSession(models.Model):
|
||||
|
||||
super(PlannedSession,self).save(*args, **kwargs)
|
||||
|
||||
class PopUpRegatta(PlannedSession):
|
||||
from django.core.validators import RegexValidator,validate_email
|
||||
|
||||
class VirtualRace(PlannedSession):
|
||||
has_registration = models.BooleanField(default=False)
|
||||
registration_closure = models.DateTimeField(blank=True,null=True)
|
||||
evaluation_closure = models.DateTimeField(blank=True,null=True)
|
||||
start_time = models.TimeField(blank=True,null=True)
|
||||
end_time = models.TimeField(blank=True,null=True)
|
||||
country = models.CharField(max_length=100,blank=True)
|
||||
|
||||
phone_regex = RegexValidator(
|
||||
regex=r'^\+?1?\d{9,15}$',
|
||||
message="Phone number must be entered in the format: '+999999999'. Up to 15 digits allowed."
|
||||
)
|
||||
|
||||
contact_phone = models.CharField(validators=[phone_regex], max_length=17, blank=True)
|
||||
|
||||
contact_email = models.EmailField(max_length=254,blank=True,
|
||||
validators=[validate_email])
|
||||
|
||||
# Date input utility
|
||||
class DateInput(forms.DateInput):
|
||||
|
||||
21
rowers/templates/virtualevents.html
Normal file
21
rowers/templates/virtualevents.html
Normal file
@@ -0,0 +1,21 @@
|
||||
{% extends "base.html" %}
|
||||
{% load staticfiles %}
|
||||
{% load rowerfilters %}
|
||||
|
||||
{% block title %}Rowsandall Virtual Racing{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="grid_12">
|
||||
<form>
|
||||
{{ form.as_table }}
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
@@ -143,6 +143,7 @@ urlpatterns = [
|
||||
url(r'^u/(?P<userid>\d+)/list-workouts/$',views.workouts_view),
|
||||
url(r'^u/(?P<userid>\d+)/list-workouts/(?P<startdatestring>\w+.*)/(?P<enddatestring>\w+.*)$',views.workouts_view),
|
||||
url(r'^list-workouts/(?P<startdatestring>\w+.*)/(?P<enddatestring>\w+.*)$',views.workouts_view),
|
||||
url(r'^virtualevents$',views.virtualevents_view),
|
||||
url(r'^list-workouts/$',views.workouts_view),
|
||||
url(r'^list-courses/$',views.courses_view),
|
||||
url(r'^courses/upload$',views.course_upload_view),
|
||||
|
||||
@@ -34,6 +34,7 @@ from rowers.forms import (
|
||||
WorkFlowLeftPanelElement,WorkFlowMiddlePanelElement,
|
||||
LandingPageForm,PlannedSessionSelectForm,WorkoutSessionSelectForm,
|
||||
PlannedSessionTeamForm,PlannedSessionTeamMemberForm,
|
||||
VirtualRaceSelectForm,
|
||||
)
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.core.exceptions import PermissionDenied
|
||||
@@ -65,7 +66,7 @@ from rowers.models import (
|
||||
Team,TeamForm,TeamInviteForm,TeamInvite,TeamRequest,
|
||||
WorkoutComment,WorkoutCommentForm,RowerExportForm,
|
||||
CalcAgePerformance,PowerTimeFitnessMetric,PlannedSessionForm,
|
||||
PlannedSessionFormSmall,GeoCourseEditForm,
|
||||
PlannedSessionFormSmall,GeoCourseEditForm,VirtualRace,
|
||||
)
|
||||
from rowers.models import (
|
||||
FavoriteForm,BaseFavoriteFormSet,SiteAnnouncement,BasePlannedSessionFormSet
|
||||
@@ -13289,3 +13290,15 @@ def plannedsession_deleteconfirm_view(request,id=0):
|
||||
}
|
||||
|
||||
)
|
||||
|
||||
def virtualevents_view(request):
|
||||
|
||||
races = VirtualRace.objects.all()
|
||||
|
||||
form = VirtualRaceSelectForm()
|
||||
|
||||
return render(request,'virtualevents.html',
|
||||
{ 'races':races,
|
||||
'form':form,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block challenges %}
|
||||
<a class="button gray" href="/rowers/challenges">Race</a>
|
||||
<a class="button gray" href="/rowers/virtualevents">Racing</a>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
@@ -62,6 +62,10 @@
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block challenges %}
|
||||
<a class="button gray" href="/rowers/virtualevents">Racing</a>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block body_bottom %}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user