improved workout edit form
This commit is contained in:
@@ -1495,7 +1495,8 @@ class Workout(models.Model):
|
||||
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)
|
||||
workouttype = models.CharField(choices=workouttypes,max_length=50,
|
||||
verbose_name='Exercise/Boat Class')
|
||||
workoutsource = models.CharField(max_length=100,
|
||||
default='unknown')
|
||||
boattype = models.CharField(choices=boattypes,max_length=50,
|
||||
@@ -1508,7 +1509,11 @@ class Workout(models.Model):
|
||||
max_length=100)
|
||||
distance = models.IntegerField(default=0,blank=True)
|
||||
duration = models.TimeField(default=1,blank=True)
|
||||
weightcategory = models.CharField(default="hwt",max_length=10,choices=weightcategories)
|
||||
weightcategory = models.CharField(
|
||||
default="hwt",
|
||||
max_length=10,
|
||||
choices=weightcategories,
|
||||
verbose_name='Weight Category')
|
||||
weightvalue = models.FloatField(default=80.0,blank=True,verbose_name = 'Average Crew Weight (kg)')
|
||||
csvfilename = models.CharField(blank=True,max_length=150)
|
||||
uploadedtoc2 = models.IntegerField(default=0)
|
||||
@@ -1794,7 +1799,7 @@ class WorkoutForm(ModelForm):
|
||||
# duration = forms.TimeInput(format='%H:%M:%S.%f')
|
||||
class Meta:
|
||||
model = Workout
|
||||
fields = ['name','date','starttime','timezone','duration','distance','workouttype','weightcategory','notes','privacy','rankingpiece','boattype']
|
||||
fields = ['name','date','starttime','timezone','duration','distance','workouttype','boattype','weightcategory','notes','privacy','rankingpiece']
|
||||
widgets = {
|
||||
'date': AdminDateWidget(),
|
||||
'notes': forms.Textarea,
|
||||
@@ -1806,7 +1811,7 @@ class WorkoutForm(ModelForm):
|
||||
# this line to be removed
|
||||
del self.fields['privacy']
|
||||
|
||||
if self.instance.workouttype != 'water':
|
||||
if self.instance.workouttype not in types.otwtypes:
|
||||
del self.fields['boattype']
|
||||
|
||||
fieldorder = (
|
||||
|
||||
Reference in New Issue
Block a user