Implement running scheduled rules and check aggregations
This commit is contained in:
@@ -3,7 +3,8 @@ from django.contrib.auth.forms import UserCreationForm
|
||||
from django.core.exceptions import FieldDoesNotExist
|
||||
from django.forms import ModelForm
|
||||
|
||||
from core.db import QueryError
|
||||
from core.db.storage import db
|
||||
from core.lib.parsing import QueryError
|
||||
from core.lib.rules import NotificationRuleData, RuleParseError
|
||||
|
||||
from .models import NotificationRule, NotificationSettings, User
|
||||
@@ -107,7 +108,9 @@ class NotificationRuleForm(RestrictedFormMixin, ModelForm):
|
||||
def clean(self):
|
||||
cleaned_data = super(NotificationRuleForm, self).clean()
|
||||
try:
|
||||
parsed_data = NotificationRuleData(self.request.user, cleaned_data)
|
||||
# Passing db to avoid circular import
|
||||
parsed_data = NotificationRuleData(self.request.user, cleaned_data, db=db)
|
||||
parsed_data.test_schedule()
|
||||
except RuleParseError as e:
|
||||
self.add_error(e.field, f"Parsing error: {e}")
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user