Set URL label properly

This commit is contained in:
Mark Veidemanis 2023-02-09 07:20:07 +00:00
parent af5c212450
commit 2c12854a55
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 10 additions and 0 deletions

View File

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