From 74ff1f98740bea1c3f18ae237066571e1290b62a Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Mon, 25 May 2020 21:58:00 +0200 Subject: [PATCH] added coursestandards to virtualrace --- rowers/models.py | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/rowers/models.py b/rowers/models.py index aa480b92..21861c49 100644 --- a/rowers/models.py +++ b/rowers/models.py @@ -2194,7 +2194,22 @@ class PlannedSession(models.Model): from django.core.validators import RegexValidator,validate_email +class StandardCollection(models.Model): + name = models.CharField(max_length=150) +class CourseStandard(models.Model): + name = models.CharField(max_length=150) + coursedistance = models.IntegerField() + coursestandard = models.FloatField() # average boat speed + agemin = models.IntegerField(default=0) + agemax = models.IntegerField(default=120) + boatclass = models.CharField(max_length=150) # corresponds to workout workouttype + boattype = models.CharField(choices=mytypes.boattypes,max_length=50,default='1x') + sex = models.CharField(max_length=150) + weightclass = models.CharField(max_length=150) + adaptiveclass = models.CharField(choices=mytypes.adaptivetypes,max_length=50,default="None") + skillclass = models.CharField(max_length=150) + standardcollection = models.ForeignKey(StandardCollection,on_delete=models.CASCADE) registerchoices = ( ('windowstart','Start of challenge Window'), @@ -2233,6 +2248,8 @@ class VirtualRace(PlannedSession): contact_email = models.EmailField(max_length=254, validators=[validate_email],blank=True) + coursestandards = models.ForeignKey(StandardCollection,null=True,on_delete=models.SET_NULL) + def __str__(self): name = self.name @@ -3790,20 +3807,3 @@ class ShareKey(models.Model): @property def expiration_date(self): return self.creation_date + datetime.timedelta(self.expiration_seconds) - -class StandardCollection(models.Model): - name = models.CharField(max_length=150) - -class CourseStandard(models.Model): - name = models.CharField(max_length=150) - coursedistance = models.IntegerField() - coursestandard = models.FloatField() # average boat speed - agemin = models.IntegerField(default=0) - agemax = models.IntegerField(default=120) - boatclass = models.CharField(max_length=150) # corresponds to workout workouttype - boattype = models.CharField(choices=boattypes,max_length=50,default='1x') - sex = models.CharField(max_length=150) - weightclass = models.CharField(max_length=150) - adaptiveclass = models.CharField(choices=mytypes.adaptivetypes,max_length=50,default="None") - skillclass = models.CharField(max_length=150) - standardcollection = models.ForeignKey(StandardCollection,on_delete=models.CASCADE)