added OTW and workouttype to favoritechart model
This commit is contained in:
@@ -136,6 +136,12 @@ class FavoriteChart(models.Model):
|
||||
('finish','Finish Angle'),
|
||||
('peakforceangle','Peak Force Angle'),
|
||||
)
|
||||
|
||||
workouttypechoices = (
|
||||
('ote','Erg/SkiErg'),
|
||||
('otw','On The Water'),
|
||||
('both','both')
|
||||
)
|
||||
|
||||
plottypes = (
|
||||
('line','Line Chart'),
|
||||
@@ -143,15 +149,20 @@ class FavoriteChart(models.Model):
|
||||
)
|
||||
|
||||
yparam1 = models.CharField(max_length=50,choices=y1params,verbose_name='Y1')
|
||||
yparam2 = models.CharField(max_length=50,choices=y2params,verbose_name='Y2')
|
||||
yparam2 = models.CharField(max_length=50,choices=y2params,verbose_name='Y2',default='None',blank=True)
|
||||
xparam = models.CharField(max_length=50,choices=xparams,verbose_name='X')
|
||||
plottype = models.CharField(max_length=50,choices=plottypes,default='line')
|
||||
plottype = models.CharField(max_length=50,choices=plottypes,
|
||||
default='line',
|
||||
verbose_name='Chart Type')
|
||||
workouttype = models.CharField(max_length=50,choices=workouttypechoices,
|
||||
default='both',
|
||||
verbose_name='Workout Type')
|
||||
user = models.ForeignKey(Rower)
|
||||
|
||||
class FavoriteForm(ModelForm):
|
||||
class Meta:
|
||||
model = FavoriteChart
|
||||
fields = ['xparam','yparam1','yparam2','plottype']
|
||||
fields = ['xparam','yparam1','yparam2','plottype','workouttype']
|
||||
|
||||
class BaseFavoriteFormSet(BaseFormSet):
|
||||
def clean(self):
|
||||
@@ -170,6 +181,15 @@ class BaseFavoriteFormSet(BaseFormSet):
|
||||
'Must have x parameter.',
|
||||
code='missing_xparam'
|
||||
)
|
||||
|
||||
if not yparam1:
|
||||
raise forms.ValidationError(
|
||||
'Must have Y1 parameter.',
|
||||
code='missing_yparam1'
|
||||
)
|
||||
|
||||
if not yparam2:
|
||||
yparam2 = 'None'
|
||||
|
||||
class Workout(models.Model):
|
||||
workouttypes = (
|
||||
|
||||
Reference in New Issue
Block a user