Skip to content

Commit 92925af

Browse files
committed
Increase Webhook notification URL max_length to 600
1 parent 4f1a5dc commit 92925af

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

readthedocs/projects/forms.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -495,12 +495,10 @@ def save(self):
495495
return self.project
496496

497497

498-
class WebHookForm(forms.Form):
498+
class WebHookForm(forms.ModelForm):
499499

500500
"""Project webhook form."""
501501

502-
url = forms.URLField()
503-
504502
def __init__(self, *args, **kwargs):
505503
self.project = kwargs.pop('project', None)
506504
super(WebHookForm, self).__init__(*args, **kwargs)
@@ -510,10 +508,14 @@ def clean_url(self):
510508
url=self.cleaned_data['url'], project=self.project)[0]
511509
return self.webhook
512510

513-
def save(self):
511+
def save(self, commit=True):
514512
self.project.webhook_notifications.add(self.webhook)
515513
return self.project
516514

515+
class Meta:
516+
model = WebHook
517+
fields = ['url']
518+
517519

518520
class TranslationBaseForm(forms.Form):
519521

readthedocs/projects/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ def __str__(self):
958958

959959
@python_2_unicode_compatible
960960
class WebHook(Notification):
961-
url = models.URLField(blank=True,
961+
url = models.URLField(max_length=600, blank=True,
962962
help_text=_('URL to send the webhook to'))
963963

964964
def __str__(self):

0 commit comments

Comments
 (0)