link to plannedsession in workout model
This commit is contained in:
163
rowers/models.py
163
rowers/models.py
@@ -643,6 +643,87 @@ timezones = (
|
||||
(x,x) for x in pytz.common_timezones
|
||||
)
|
||||
|
||||
# model for Planned Session (Workout, Challenge, Test)
|
||||
class PlannedSession(models.Model):
|
||||
|
||||
sessiontypechoices = (
|
||||
('session','Training Session'),
|
||||
('challenge','Challenge'),
|
||||
('test','Mandatory Test'),
|
||||
)
|
||||
|
||||
sessionmodechoices = (
|
||||
('distance','Distance'),
|
||||
('time','Time')
|
||||
)
|
||||
|
||||
criteriumchoices = (
|
||||
('none','None'),
|
||||
('minimum','At Least'),
|
||||
('exact','Exactly'),
|
||||
)
|
||||
|
||||
verificationchoices = (
|
||||
('none','None'),
|
||||
('automatic','Automatic'),
|
||||
('manual','Manual')
|
||||
)
|
||||
|
||||
sessionunitchoices = (
|
||||
('min','minutes'),
|
||||
('km','km'),
|
||||
('m','meters')
|
||||
)
|
||||
|
||||
manager = models.ForeignKey(User)
|
||||
name = models.CharField(max_length=150,blank=True)
|
||||
comment = models.TextField(max_length=300,blank=True)
|
||||
startdate = models.DateField(default=timezone.now,
|
||||
verbose_name='Start Date')
|
||||
enddate = models.DateField(default=timezone.now,
|
||||
verbose_name='End Date')
|
||||
sessiontype = models.CharField(default='session',
|
||||
choices=sessiontypechoices,
|
||||
max_length=150)
|
||||
sessionvalue = models.IntegerField(default=60,verbose_name='Value')
|
||||
sessionunit = models.CharField(
|
||||
default='min',choices=sessionunitchoices,
|
||||
max_length=150,
|
||||
verbose_name='Unit')
|
||||
criterium = models.CharField(
|
||||
default='none',
|
||||
choices=criteriumchoices,
|
||||
max_length=150)
|
||||
verification = models.CharField(
|
||||
default='none',
|
||||
max_length=150,
|
||||
choices=verificationchoices
|
||||
)
|
||||
|
||||
team = models.ManyToManyField(Team,blank=True)
|
||||
rower = models.ManyToManyField(Rower,blank=True)
|
||||
|
||||
sessionmode = models.CharField(default='distance',
|
||||
choices=sessionmodechoices,
|
||||
max_length=150)
|
||||
|
||||
hasranking = models.BooleanField(default=False)
|
||||
|
||||
class PlannedSessionForm(ModelForm):
|
||||
class Meta:
|
||||
model = PlannedSession
|
||||
fields = ['name','comment','startdate','enddate','sessionvalue',
|
||||
'sessionunit']
|
||||
widgets = {
|
||||
'comment': forms.Textarea,
|
||||
'startdate': SelectDateWidget(
|
||||
years=range(
|
||||
timezone.now().year-1,timezone.now().year+1)),
|
||||
'enddate': SelectDateWidget(
|
||||
years=range(
|
||||
timezone.now().year-1,timezone.now().year+1)),
|
||||
}
|
||||
|
||||
|
||||
# Workout
|
||||
class Workout(models.Model):
|
||||
@@ -653,6 +734,7 @@ class Workout(models.Model):
|
||||
|
||||
user = models.ForeignKey(Rower)
|
||||
team = models.ManyToManyField(Team,blank=True)
|
||||
plannedsession = models.ForeignKey(PlannedSession, blank=True,null=True)
|
||||
name = models.CharField(max_length=150)
|
||||
date = models.DateField()
|
||||
workouttype = models.CharField(choices=workouttypes,max_length=50)
|
||||
@@ -1388,84 +1470,3 @@ class WorkoutCommentForm(ModelForm):
|
||||
'comment': forms.Textarea,
|
||||
}
|
||||
|
||||
# model for Planned Session (Workout, Challenge, Test)
|
||||
class PlannedSession(models.Model):
|
||||
|
||||
sessiontypechoices = (
|
||||
('session','Training Session'),
|
||||
('challenge','Challenge'),
|
||||
('test','Mandatory Test'),
|
||||
)
|
||||
|
||||
sessionmodechoices = (
|
||||
('distance','Distance'),
|
||||
('time','Time')
|
||||
)
|
||||
|
||||
criteriumchoices = (
|
||||
('none','None'),
|
||||
('minimum','At Least'),
|
||||
('exact','Exactly'),
|
||||
)
|
||||
|
||||
verificationchoices = (
|
||||
('none','None'),
|
||||
('automatic','Automatic'),
|
||||
('manual','Manual')
|
||||
)
|
||||
|
||||
sessionunitchoices = (
|
||||
('min','minutes'),
|
||||
('km','km'),
|
||||
('m','meters')
|
||||
)
|
||||
|
||||
manager = models.ForeignKey(User)
|
||||
name = models.CharField(max_length=150,blank=True)
|
||||
comment = models.TextField(max_length=300,blank=True)
|
||||
startdate = models.DateField(default=timezone.now,
|
||||
verbose_name='Start Date')
|
||||
enddate = models.DateField(default=timezone.now,
|
||||
verbose_name='End Date')
|
||||
sessiontype = models.CharField(default='session',
|
||||
choices=sessiontypechoices,
|
||||
max_length=150)
|
||||
sessionvalue = models.IntegerField(default=60,verbose_name='Value')
|
||||
sessionunit = models.CharField(
|
||||
default='min',choices=sessionunitchoices,
|
||||
max_length=150,
|
||||
verbose_name='Unit')
|
||||
criterium = models.CharField(
|
||||
default='none',
|
||||
choices=criteriumchoices,
|
||||
max_length=150)
|
||||
verification = models.CharField(
|
||||
default='none',
|
||||
max_length=150,
|
||||
choices=verificationchoices
|
||||
)
|
||||
|
||||
team = models.ManyToManyField(Team,blank=True)
|
||||
rower = models.ManyToManyField(Rower,blank=True)
|
||||
|
||||
sessionmode = models.CharField(default='distance',
|
||||
choices=sessionmodechoices,
|
||||
max_length=150)
|
||||
|
||||
hasranking = models.BooleanField(default=False)
|
||||
|
||||
class PlannedSessionForm(ModelForm):
|
||||
class Meta:
|
||||
model = PlannedSession
|
||||
fields = ['name','comment','startdate','enddate','sessionvalue',
|
||||
'sessionunit']
|
||||
widgets = {
|
||||
'comment': forms.Textarea,
|
||||
'startdate': SelectDateWidget(
|
||||
years=range(
|
||||
timezone.now().year-1,timezone.now().year+1)),
|
||||
'enddate': SelectDateWidget(
|
||||
years=range(
|
||||
timezone.now().year-1,timezone.now().year+1)),
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user