aboutsummaryrefslogtreecommitdiffstats
path: root/servo/models/rules.py
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2021-05-12 15:32:50 +0300
committerFilipp Lepalaan <filipp@mac.com>2021-05-12 15:32:50 +0300
commit5295e88be1a5d3ac1aa94ae267d839e58cc92c5d (patch)
tree174a55f5b8e41cb07114953fd4d1672c0f72b2b2 /servo/models/rules.py
parentad45447445f5be4c14b4b11d798606748e0aa518 (diff)
downloadServo-5295e88be1a5d3ac1aa94ae267d839e58cc92c5d.tar.gz
Servo-5295e88be1a5d3ac1aa94ae267d839e58cc92c5d.tar.bz2
Servo-5295e88be1a5d3ac1aa94ae267d839e58cc92c5d.zip
Django 3 fixes
Diffstat (limited to 'servo/models/rules.py')
-rw-r--r--servo/models/rules.py8
1 files changed, 4 insertions, 4 deletions
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