saveState not working yet
This commit is contained in:
@@ -2427,6 +2427,31 @@ class PlannedSessionStep(models.Model):
|
||||
notes = models.TextField(default='',max_length=200, blank=True, null=True)
|
||||
color = models.TextField(default='#ddd',max_length=200)
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
if self.intensity == "Warmup":
|
||||
self.color = "#ffcccb"
|
||||
elif self.intensity == "Cooldown":
|
||||
self.color = '#90ee90'
|
||||
elif self.intensity == "Rest":
|
||||
self.color = 'add8e6'
|
||||
|
||||
super(PlannedSessionStep, self).save(*args, **kwargs)
|
||||
|
||||
class StepEditorForm(ModelForm):
|
||||
class Meta:
|
||||
model = PlannedSessionStep
|
||||
fields = [
|
||||
'name',
|
||||
#'type',
|
||||
'durationtype',
|
||||
'durationvalue',
|
||||
'intensity',
|
||||
]
|
||||
|
||||
widgets = {
|
||||
'name': forms.Textarea(attrs={'rows':1, 'cols':50}),
|
||||
}
|
||||
|
||||
|
||||
class PlannedSession(models.Model):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user