Private
Public Access
1
0

saveState not working yet

This commit is contained in:
Sander Roosendaal
2022-04-05 16:25:36 +02:00
parent fdcad2a3f1
commit 22d5ee5e3f
5 changed files with 107 additions and 45 deletions

View File

@@ -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):