Private
Public Access
1
0

working, passing tests in django 3.2

This commit is contained in:
Sander Roosendaal
2021-12-14 16:36:22 +01:00
parent 3fc1c8905c
commit 1e2e6ae87a
21 changed files with 311 additions and 62 deletions

View File

@@ -4,7 +4,6 @@ from __future__ import print_function
from __future__ import unicode_literals
from __future__ import unicode_literals, absolute_import
import uuid
from django.utils.encoding import python_2_unicode_compatible
from django.db import models,IntegrityError
from django.contrib.auth.models import User
@@ -403,7 +402,7 @@ class PowerTimeFitnessMetric(models.Model):
class Meta:
db_table = 'powertimefitnessmetric'
@python_2_unicode_compatible
class C2WorldClassAgePerformance(models.Model):
weightcategories = mytypes.weightcategories
@@ -445,7 +444,7 @@ class C2WorldClassAgePerformance(models.Model):
return thestring
@python_2_unicode_compatible
class Team(models.Model):
choices = (
('private','private'),
@@ -742,7 +741,7 @@ paymentprocessors = (
('braintree','BrainTree')
)
@python_2_unicode_compatible
class PaidPlan(models.Model):
shortname = models.CharField(max_length=50,choices=plans)
name = models.CharField(max_length=200)
@@ -769,7 +768,7 @@ class PaidPlan(models.Model):
paymentprocessor = self.paymentprocessor,
)
@python_2_unicode_compatible
class CoachingGroup(models.Model):
name = models.CharField(default='group',max_length=30,null=True,blank=True)
@@ -787,7 +786,7 @@ class CoachingGroup(models.Model):
return Rower.objects.filter(mycoachgroup=self)
# Extension of User with rowing specific data
@python_2_unicode_compatible
class Rower(models.Model):
adaptivetypes = mytypes.adaptivetypes
stravatypes = (
@@ -879,7 +878,7 @@ class Rower(models.Model):
default='braintree')
eurocredits = models.IntegerField(default=0)
paidplan = models.ForeignKey(PaidPlan,null=True,default=None,on_delete=models.SET_NULL)
planexpires = models.DateField(default=current_day)
@@ -1439,7 +1438,7 @@ timezones = (
# models related to geo data (points, polygon, courses)
@python_2_unicode_compatible
class GeoCourse(models.Model):
manager = models.ForeignKey(Rower,null=True,on_delete=models.SET_NULL)
distance = models.IntegerField(default=0)
@@ -1475,7 +1474,7 @@ class GeoCourseEditForm(ModelForm):
'notes': forms.Textarea,
}
@python_2_unicode_compatible
class GeoPolygon(models.Model):
name = models.CharField(max_length=150,blank=True)
course = models.ForeignKey(GeoCourse, blank=True,on_delete=models.CASCADE,related_name='polygons')
@@ -1630,7 +1629,7 @@ class InstantPlanForm(ModelForm):
'yaml',
]
@python_2_unicode_compatible
class TrainingPlan(models.Model):
statuschoices = (
@@ -2035,7 +2034,7 @@ def macrocyclecheckdates(plan): # pragma: no cover
pass
cycles = cycles[1:]
@python_2_unicode_compatible
class TrainingMacroCycle(models.Model):
plan = models.ForeignKey(TrainingPlan,on_delete=models.CASCADE)
name = models.CharField(max_length=150,blank=True)
@@ -2124,7 +2123,7 @@ class TrainingMacroCycleForm(ModelForm):
'enddate': AdminDateWidget()
}
@python_2_unicode_compatible
class TrainingMesoCycle(models.Model):
plan = models.ForeignKey(TrainingMacroCycle,on_delete=models.CASCADE)
name = models.CharField(max_length=150,blank=True)
@@ -2204,7 +2203,7 @@ class TrainingMesoCycle(models.Model):
createmicrofillers(self)
@python_2_unicode_compatible
class TrainingMicroCycle(models.Model):
plan = models.ForeignKey(TrainingMesoCycle,on_delete=models.CASCADE)
name = models.CharField(max_length=150,blank=True)
@@ -2301,7 +2300,7 @@ regularsessiontypechoices = (
)
# model for Planned Session (Workout, Challenge, Test)
@python_2_unicode_compatible
class PlannedSession(models.Model):
sessiontypechoices = (
@@ -2605,7 +2604,7 @@ registerchoices = (
('manual','Manual - select below'),
)
@python_2_unicode_compatible
class VirtualRace(PlannedSession):
# has_registration = models.BooleanField(default=False)
registration_form = models.CharField(
@@ -3187,7 +3186,7 @@ class Workout(models.Model):
starttime = models.TimeField(default=timezone.now)
startdatetime = models.DateTimeField(blank=True,null=True)
timezone = models.CharField(default='UTC',
choices=timezones,
#choices=timezones,
max_length=100)
distance = models.IntegerField(default=0)
duration = models.TimeField(blank=True)
@@ -3404,7 +3403,7 @@ class FollowerForm(ModelForm):
fields = ['emailaddress']
# Virtual Race results (for keeping results when workouts are deleted)
@python_2_unicode_compatible
class VirtualRaceResult(models.Model):
boatclasses = (type for type in mytypes.workouttypes if type[0] in mytypes.otwtypes)
userid = models.IntegerField(default=0)
@@ -3529,7 +3528,7 @@ class VirtualRaceResult(models.Model):
)
# Virtual Race results (for keeping results when workouts are deleted)
@python_2_unicode_compatible
class IndoorVirtualRaceResult(models.Model):
boatclasses = (type for type in mytypes.workouttypes if type[0] in mytypes.otetypes)
userid = models.IntegerField(default=0) # ID of rower object
@@ -3794,7 +3793,7 @@ class ergcpdata(models.Model):
app_label = 'rowers'
# A wrapper around the png files
@python_2_unicode_compatible
class GraphImage(models.Model):
filename = models.CharField(default='',max_length=150,blank=True,null=True)
creationdatetime = models.DateTimeField()
@@ -3856,7 +3855,9 @@ class WorkoutForm(ModelForm):
label='Private')
self.fields['timezone'] = forms.ChoiceField(
choices = [(x,x) for x in pytz.common_timezones]
choices = (
(x,x) for x in pytz.common_timezones
)
)
if 'instance' in kwargs:
@@ -4547,7 +4548,7 @@ class SiteAnnouncement(models.Model):
return super(SiteAnnouncement,self).save(*args, **kwargs)
# A comment by a user on a training
@python_2_unicode_compatible
class WorkoutComment(models.Model):
comment = models.TextField(max_length=300)
created = models.DateTimeField(default=timezone.now)
@@ -4573,7 +4574,7 @@ class WorkoutCommentForm(ModelForm):
}
# A comment by a user on a training
@python_2_unicode_compatible
class PlannedSessionComment(models.Model):
comment = models.TextField(max_length=300)
created = models.DateTimeField(default=timezone.now)