From 5295e88be1a5d3ac1aa94ae267d839e58cc92c5d Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Wed, 12 May 2021 15:32:50 +0300 Subject: Django 3 fixes --- servo/models/rules.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'servo/models/rules.py') diff --git a/servo/models/rules.py b/servo/models/rules.py index 26fab03..14fc3bb 100644 --- a/servo/models/rules.py +++ b/servo/models/rules.py @@ -80,7 +80,7 @@ class Rule(ServoModel): class Condition(ServoModel): - rule = models.ForeignKey(Rule) + rule = models.ForeignKey(Rule, on_delete=models.CASCADE) EVENT_MAP = { 'device_added': 'DEVICE', @@ -118,7 +118,7 @@ class Condition(ServoModel): class Action(ServoModel): - rule = models.ForeignKey(Rule) + rule = models.ForeignKey(Rule, on_delete=models.CASCADE) KEY_CHOICES = ( ('SEND_SMS', _('Send SMS')), @@ -156,9 +156,9 @@ class Action(ServoModel): def process_event(sender, instance, created, **kwargs): try: condition = Condition.EVENT_MAP[instance.action] - print condition + print(condition) for r in Rule.objects.filter(condition__key=condition): - print 'APPLYING %s' % condition + print('APPLYING %s' % condition) r.apply(instance) except KeyError: return # no mapping for this event -- cgit v1.2.3