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

Update UserKey views to use "object" context var

This commit is contained in:
Jeremy Stretch
2020-11-19 13:43:17 -05:00
parent 2f1ca902f7
commit e5caea04c1
3 changed files with 10 additions and 10 deletions

View File

@ -3,7 +3,7 @@
{% block title %}User Key{% endblock %}
{% block usercontent %}
{% if userkey %}
{% if object %}
<div class="pull-right noprint">
<a href="{% url 'user:userkey_edit' %}" class="btn btn-warning">
<span class="mdi mdi-pencil" aria-hidden="true"></span>
@ -12,22 +12,22 @@
</div>
<h4>
Your user key is:
{% if userkey.is_active %}
{% if object.is_active %}
<span class="label label-success">Active</span>
{% else %}
<span class="label label-danger">Inactive</span>
{% endif %}
</h4>
{% include 'inc/created_updated.html' with obj=userkey %}
{% if not userkey.is_active %}
{% include 'inc/created_updated.html' %}
{% if not object.is_active %}
<div class="alert alert-warning" role="alert">
<i class="mdi mdi-alert"></i>
Your user key is inactive. Ask an administrator to enable it for you.
</div>
{% endif %}
<pre>{{ userkey.public_key }}</pre>
<pre>{{ object.public_key }}</pre>
<hr />
{% if userkey.session_key %}
{% if object.session_key %}
<div class="pull-right noprint">
<a href="{% url 'user:sessionkey_delete' %}" class="btn btn-danger">
<span class="mdi mdi-trash-can-outline" aria-hidden="true"></span>
@ -35,7 +35,7 @@
</a>
</div>
<h4>Session key: <span class="label label-success">Active</span></h4>
<small class="text-muted">Created {{ userkey.session_key.created }}</small>
<small class="text-muted">Created {{ object.session_key.created }}</small>
{% else %}
<h4>No active session key</h4>
{% endif %}

View File

@ -5,7 +5,7 @@
{% block title %}User Key{% endblock %}
{% block usercontent %}
{% if userkey.is_active %}
{% if object.is_active %}
<div class="alert alert-danger" role="alert">
<strong>Warning:</strong> Changing your public key will require your user key to be re-activated by another
user. You will be unable to retrieve any secrets until your key has been reactivated.

View File

@ -185,7 +185,7 @@ class UserKeyView(LoginRequiredMixin, View):
userkey = None
return render(request, self.template_name, {
'userkey': userkey,
'object': userkey,
'active_tab': 'userkey',
})
@ -205,7 +205,7 @@ class UserKeyEditView(LoginRequiredMixin, View):
form = UserKeyForm(instance=self.userkey)
return render(request, self.template_name, {
'userkey': self.userkey,
'object': self.userkey,
'form': form,
'active_tab': 'userkey',
})