Skip to content

Commit

Permalink
Closes #1320: Remove checkbox from confirmation dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremystretch committed Jul 12, 2017
1 parent 74828e1 commit 1ef9090
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
3 changes: 1 addition & 2 deletions netbox/dcim/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -1694,8 +1694,7 @@ def clean_interface_b(self):
return interface


class InterfaceConnectionDeletionForm(BootstrapMixin, forms.Form):
confirm = forms.BooleanField(required=True)
class InterfaceConnectionDeletionForm(ConfirmationForm):
# Used for HTTP redirect upon successful deletion
device = forms.ModelChoiceField(queryset=Device.objects.all(), widget=forms.HiddenInput(), required=False)

Expand Down
16 changes: 4 additions & 12 deletions netbox/templates/utilities/confirmation_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,14 @@
<div class="row">
<div class="col-md-6 col-md-offset-3">
<form action="." method="post" class="form">
{% csrf_token %}
{% for field in form.hidden_fields %}
{{ field }}
{% endfor %}
{% csrf_token %}
{% for field in form.hidden_fields %}
{{ field }}
{% endfor %}
<div class="panel panel-{{ panel_class|default:"danger" }}">
<div class="panel-heading">{% block title %}{% endblock %}</div>
<div class="panel-body">
{% block message %}<p>Are you sure?</p>{% endblock %}
<div class="form-group">
<div class="checkbox{% if form.confirm.errors %} has-error{% endif %}">
<label for="{{ form.confirm.id_for_label }}">
{{ form.confirm }}
{{ form.confirm.label }}
</label>
</div>
</div>
<div class="text-right">
<button type="submit" name="_confirm" class="btn btn-{{ button_class|default:"danger" }}">Confirm</button>
<a href="{{ return_url }}" class="btn btn-default">Cancel</a>
Expand Down
2 changes: 1 addition & 1 deletion netbox/utilities/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ class ConfirmationForm(BootstrapMixin, ReturnURLForm):
"""
A generic confirmation form. The form is not valid unless the confirm field is checked.
"""
confirm = forms.BooleanField(required=True)
confirm = forms.BooleanField(required=True, widget=forms.HiddenInput(), initial=True)


class BulkEditForm(forms.Form):
Expand Down

0 comments on commit 1ef9090

Please sign in to comment.