Private
Public Access
1
0

first model of basic alert functions

This commit is contained in:
Sander Roosendaal
2019-08-09 16:12:50 +02:00
parent d0a8abc85b
commit 9024aa7686
2 changed files with 89 additions and 2 deletions

View File

@@ -1018,11 +1018,12 @@ class Condition(models.Model):
('<','<'),
('>','>'),
('=','='),
('between','between')
)
metric = models.CharField(max_length=50,choices=parchoicesy1,verbose_name='Metric')
value = models.FloatField(default=0)
value1 = models.FloatField(default=0)
value2 = 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:
@@ -1031,10 +1032,15 @@ for key,value in mytypes.workouttypes:
class Alert(models.Model):
name = models.CharField(max_length=150,verbose_name='Name',null=True,blank=True)
manager = models.ForeignKey(User, on_delete=models.CASCADE)
rower = models.ForeignKey(Rower, on_delete=models.CASCADE)
measured = models.OneToOneField(Condition,verbose_name='Measuring',on_delete=models.CASCADE,
related_name='measured')
filter = models.ManyToManyField(Condition, related_name='filters',verbose_name='Filters')
reststrokes = models.BooleanField(default=False,null=True,verbose_name='Include Rest Strokes')
period = models.IntegerField(default=7,verbose_name='Reporting Period')
next_run = models.DateField(default=timezone.now)
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')