Skip to content

Commit

Permalink
Fixes #429: Correct redirection of user when adding a secret to a device
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremystretch committed Aug 4, 2016
1 parent 76b9a1c commit 29c4394
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
2 changes: 1 addition & 1 deletion netbox/secrets/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def secret_add(request, pk):

messages.success(request, "Added new secret: {0}".format(secret))
if '_addanother' in request.POST:
return redirect('secrets:secret_add')
return redirect('dcim:device_addsecret', pk=device.pk)
else:
return redirect('secrets:secret', pk=secret.pk)

Expand Down
14 changes: 2 additions & 12 deletions netbox/templates/secrets/secret_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,15 @@
{% load static from staticfiles %}
{% load form_helpers %}

{% block title %}{% if secret.pk %}Editing Secret: {{ secret }}{% else %}Add a Secret{% endif %}{% endblock %}
{% block title %}{% if secret.pk %}Editing {{ secret }}{% else %}Add a Secret{% endif %}{% endblock %}

{% block content %}
{% if secret.pk %}
<h1>Editing Secret: {{ secret }}</h1>
{% else %}
<h1>Add a Secret</h1>
{% endif %}
<form action="." method="post" class="form form-horizontal requires-private-key">
{% csrf_token %}
{{ form.private_key }}
<div class="row">
<div class="col-md-6 col-md-offset-3">
<h3>{% if secret.pk %}Editing {{ secret }}{% else %}Add a Secret{% endif %}</h3>
{% if form.non_field_errors %}
<div class="panel panel-danger">
<div class="panel-heading"><strong>Errors</strong></div>
Expand All @@ -23,10 +19,6 @@ <h1>Add a Secret</h1>
</div>
</div>
{% endif %}
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><strong>Secret Attributes</strong></div>
<div class="panel-body">
Expand All @@ -41,8 +33,6 @@ <h1>Add a Secret</h1>
{% render_field form.userkeys %}
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><strong>Secret Data</strong></div>
<div class="panel-body">
Expand Down

0 comments on commit 29c4394

Please sign in to comment.