From 2c12854a55e769820f07e5bca78cfb5ad23c98da Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Thu, 9 Feb 2023 07:20:07 +0000 Subject: [PATCH] Set URL label properly --- core/forms.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/forms.py b/core/forms.py index a38b812..b4358e7 100644 --- a/core/forms.py +++ b/core/forms.py @@ -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"):