File tree Expand file tree Collapse file tree 3 files changed +12
-7
lines changed Expand file tree Collapse file tree 3 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -476,7 +476,7 @@ class WebHookForm(forms.Form):
476
476
477
477
"""Project webhook form."""
478
478
479
- url = forms .URLField ()
479
+ url = forms .URLField (max_length = WebHook . _meta . get_field ( 'url' ). max_length )
480
480
481
481
def __init__ (self , * args , ** kwargs ):
482
482
self .project = kwargs .pop ('project' , None )
Original file line number Diff line number Diff line change @@ -965,7 +965,7 @@ def __str__(self):
965
965
966
966
@python_2_unicode_compatible
967
967
class WebHook (Notification ):
968
- url = models .URLField (blank = True ,
968
+ url = models .URLField (max_length = 600 , blank = True ,
969
969
help_text = _ ('URL to send the webhook to' ))
970
970
971
971
def __str__ (self ):
Original file line number Diff line number Diff line change @@ -510,15 +510,20 @@ def project_notifications(request, project_slug):
510
510
webhook_form = WebHookForm (data = request .POST or None , project = project )
511
511
512
512
if request .method == 'POST' :
513
- if email_form . is_valid () :
514
- email_form . save ( )
515
- if webhook_form . is_valid () :
516
- webhook_form . save ( )
513
+ if 'email' not in request . POST :
514
+ email_form = EmailHookForm ( data = None , project = project )
515
+ if 'url' not in request . POST :
516
+ webhook_form = WebHookForm ( data = None , project = project )
517
517
project_dashboard = reverse (
518
518
'projects_notifications' ,
519
519
args = [project .slug ],
520
520
)
521
- return HttpResponseRedirect (project_dashboard )
521
+ if email_form .is_valid ():
522
+ email_form .save ()
523
+ return HttpResponseRedirect (project_dashboard )
524
+ if webhook_form .is_valid ():
525
+ webhook_form .save ()
526
+ return HttpResponseRedirect (project_dashboard )
522
527
523
528
emails = project .emailhook_notifications .all ()
524
529
urls = project .webhook_notifications .all ()
You can’t perform that action at this time.
0 commit comments