|
|
|
@ -71,6 +71,10 @@ class CustomUserCreationForm(UserCreationForm):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class NotificationSettingsForm(RestrictedFormMixin, ModelForm):
|
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
|
super(NotificationSettingsForm, self).__init__(*args, **kwargs)
|
|
|
|
|
self.fields["url"].label = "URL"
|
|
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
|
model = NotificationSettings
|
|
|
|
|
fields = (
|
|
|
|
@ -96,6 +100,10 @@ class NotificationSettingsForm(RestrictedFormMixin, ModelForm):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class NotificationRuleForm(RestrictedFormMixin, ModelForm):
|
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
|
super(NotificationRuleForm, self).__init__(*args, **kwargs)
|
|
|
|
|
self.fields["url"].label = "URL"
|
|
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
|
model = NotificationRule
|
|
|
|
|
fields = (
|
|
|
|
@ -127,6 +135,8 @@ class NotificationRuleForm(RestrictedFormMixin, ModelForm):
|
|
|
|
|
|
|
|
|
|
def clean(self):
|
|
|
|
|
cleaned_data = super(NotificationRuleForm, self).clean()
|
|
|
|
|
|
|
|
|
|
# TODO: should this be in rules.py?
|
|
|
|
|
if "service" in cleaned_data:
|
|
|
|
|
if cleaned_data["service"] == "webhook":
|
|
|
|
|
if not cleaned_data.get("url"):
|
|
|
|
|