models for alerts and conditions
This commit is contained in:
@@ -1011,6 +1011,36 @@ class BaseFavoriteFormSet(BaseFormSet):
|
|||||||
if not yparam2:
|
if not yparam2:
|
||||||
yparam2 = 'None'
|
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):
|
class BasePlannedSessionFormSet(BaseFormSet):
|
||||||
def clean(self):
|
def clean(self):
|
||||||
if any(self.serrors):
|
if any(self.serrors):
|
||||||
|
|||||||
Reference in New Issue
Block a user