1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Improved handling of return_url for object edit/delete views; removed manual definitions of initial data fields

This commit is contained in:
Jeremy Stretch
2017-04-13 13:11:23 -04:00
parent d5c3f9e780
commit f70f0f8d62
9 changed files with 65 additions and 63 deletions

View File

@ -437,13 +437,18 @@ class BootstrapMixin(forms.BaseForm):
field.widget.attrs['placeholder'] = field.label
class ConfirmationForm(BootstrapMixin, forms.Form):
class ReturnURLForm(forms.Form):
"""
A generic confirmation form. The form is not valid unless the confirm field is checked. An optional return_url can
be specified to direct the user to a specific URL after the action has been taken.
Provides a hidden return URL field to control where the user is directed after the form is submitted.
"""
return_url = forms.CharField(required=False, widget=forms.HiddenInput())
class ConfirmationForm(BootstrapMixin, ReturnURLForm):
"""
A generic confirmation form. The form is not valid unless the confirm field is checked.
"""
confirm = forms.BooleanField(required=True)
return_url = forms.CharField(required=False, widget=forms.HiddenInput())
class BulkEditForm(forms.Form):