Private
Public Access
1
0

register and withdraw done

This commit is contained in:
Sander Roosendaal
2018-04-19 13:28:12 +02:00
parent 8bb50596a2
commit 6a9b61bef3
5 changed files with 270 additions and 13 deletions

View File

@@ -422,6 +422,12 @@ def course_length(course):
return int(totaldist)
sexcategories = (
('male','male'),
('female','female'),
('not specified','not specified'),
)
# Extension of User with rowing specific data
class Rower(models.Model):
weightcategories = (
@@ -429,11 +435,6 @@ class Rower(models.Model):
('lwt','light-weight'),
)
sexcategories = (
('male','male'),
('female','female'),
('not specified','not specified'),
)
stravatypes = (
('Ride','Ride'),
@@ -1066,6 +1067,10 @@ class VirtualRace(PlannedSession):
end_time = models.TimeField(blank=True,null=True)
country = models.CharField(max_length=100,blank=True)
timezone = models.CharField(default='UTC',
choices=timezones,
max_length=100)
phone_regex = RegexValidator(
regex=r'^\+?1?\d{9,15}$',
message="Phone number must be entered in the format: '+999999999'. Up to 15 digits allowed."
@@ -1087,6 +1092,8 @@ class VirtualRace(PlannedSession):
)
return stri
# Date input utility
class DateInput(forms.DateInput):
@@ -1199,12 +1206,12 @@ class PlannedSessionFormSmall(ModelForm):
'manager': forms.HiddenInput(),
}
boattypes = types.boattypes
# Workout
class Workout(models.Model):
workouttypes = types.workouttypes
workoutsources = types.workoutsources
boattypes = types.boattypes
privacychoices = types.privacychoices
user = models.ForeignKey(Rower)
@@ -1317,6 +1324,24 @@ def auto_delete_strokedata_on_delete(sender, instance, **kwargs):
conn.close()
engine.dispose()
# Virtual Race results (for keeping results when workouts are deleted)
class VirtualRaceResult(models.Model):
user = models.ForeignKey(Rower)
username = models.CharField(max_length=150)
workout = models.ForeignKey(Workout)
race = models.ForeignKey(VirtualRace)
duration = models.TimeField(default=3600)
boattype = models.CharField(choices=boattypes,max_length=40,
default='1x',
verbose_name = 'Boat Type'
)
sex = models.CharField(default="not specified",
max_length=30,
choices=sexcategories,
verbose_name='Gender')
from rowers.metrics import rowingmetrics
strokedatafields = {