Private
Public Access
1
0

models for alerts and conditions

This commit is contained in:
Sander Roosendaal
2019-08-07 11:51:46 +02:00
parent 7e284690de
commit d0a8abc85b

View File

@@ -1011,6 +1011,36 @@ class BaseFavoriteFormSet(BaseFormSet):
if not yparam2:
yparam2 = 'None'
class Condition(models.Model):
conditionchoices = (
('<','<'),
('>','>'),
('=','='),
)
metric = models.CharField(max_length=50,choices=parchoicesy1,verbose_name='Metric')
value = models.FloatField(default=0)
condition = models.CharField(max_length=2,choices=conditionchoices,null=True)
alert = models.ForeignKey('Alert',on_delete=models.CASCADE,null=True)
rowchoices = []
for key,value in mytypes.workouttypes:
if key in mytypes.rowtypes:
rowchoices.append((key,value))
class Alert(models.Model):
measured = models.OneToOneField(Condition,verbose_name='Measuring',on_delete=models.CASCADE,
related_name='measured')
reststrokes = models.BooleanField(default=False,null=True,verbose_name='Include Rest Strokes')
period = models.IntegerField(default=7,verbose_name='Reporting Period')
emailalert = models.BooleanField(default=True,verbose_name='Send email alerts')
workouttype = models.CharField(choices=rowchoices,max_length=50,
verbose_name='Exercise/Boat Class',default='water')
class BasePlannedSessionFormSet(BaseFormSet):
def clean(self):
if any(self.serrors):