diff --git a/rowers/forms.py b/rowers/forms.py index df48585f..cfde1fa4 100644 --- a/rowers/forms.py +++ b/rowers/forms.py @@ -716,5 +716,22 @@ class PlannedSessionTeamMemberForm(forms.Form): super(PlannedSessionTeamMemberForm,self).__init__(*args,**kwargs) 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(), + ) diff --git a/rowers/models.py b/rowers/models.py index 68279d6f..56ce044a 100644 --- a/rowers/models.py +++ b/rowers/models.py @@ -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): diff --git a/rowers/templates/virtualevents.html b/rowers/templates/virtualevents.html new file mode 100644 index 00000000..bc1f2bf0 --- /dev/null +++ b/rowers/templates/virtualevents.html @@ -0,0 +1,21 @@ +{% extends "base.html" %} +{% load staticfiles %} +{% load rowerfilters %} + +{% block title %}Rowsandall Virtual Racing{% endblock %} + +{% block scripts %} + +{% endblock %} + +{% block content %} + +