From 085832888a6ebee7f0b2d23c68ef887833f2a94d Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Wed, 18 Nov 2015 22:41:40 +0200 Subject: Cleanup --- servo/models/rules.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'servo/models/rules.py') diff --git a/servo/models/rules.py b/servo/models/rules.py index 1e6ec2d..460a0b6 100644 --- a/servo/models/rules.py +++ b/servo/models/rules.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- +import json from django.db import models from django.core.cache import cache @@ -12,6 +13,13 @@ from django.utils.translation import ugettext_lazy as _ from servo.models import Event, Queue +class RuleManager: + + def all(self): + f = open('local_rules.json', 'r') + return json.loads(f.read()) + + class ServoModel(models.Model): class Meta: abstract = True @@ -19,6 +27,9 @@ class ServoModel(models.Model): class Rule(ServoModel): + + objects = RuleManager() + description = models.CharField(max_length=128, default=_('New Rule')) MATCH_CHOICES = ( ('ANY', _('Any')), -- cgit v1.2.3