Adapted PR to comply with comments

Re-introduced certain references to make sure explicit references are still used where needed.
This commit is contained in:
Tom Strickx 2017-10-31 10:28:14 -07:00
parent bd276aae20
commit 1a61941ed3
5 changed files with 9 additions and 6 deletions

View File

@ -288,6 +288,9 @@ class Secret(CreatedUpdatedModel):
def __str__(self):
if self.role and self.device and self.name:
return '{} for {} ({})'.format(self.role, self.device, self.name)
# Return role and device if no name is set
if self.role and self.device:
return '{} for {}'.format(self.role, self.device)
return 'Secret'
def get_absolute_url(self):

View File

@ -27,13 +27,13 @@
{% ifequal u.device.face face_id %}
<a href="{% url 'dcim:device' pk=u.device.pk %}" data-toggle="popover" data-trigger="hover" data-container="body" data-html="true"
data-content="{{ u.device.device_role }}<br />{{ u.device.device_type.full_name }} ({{ u.device.device_type.u_height }}U){% if u.device.asset_tag %}<br />{{ u.device.asset_tag }}{% endif %}">
{{ u.device|default:u.device.device_role }}
{{ u.device.name|default:u.device.device_role }}
{% if u.device.devicebay_count %}
({{ u.device.get_children.count }}/{{ u.device.devicebay_count }})
{% endif %}
</a>
{% else %}
<span>{{ u.device|default:u.device.device_role }}</span>
<span>{{ u.device.name|default:u.device.device_role }}</span>
{% endifequal %}
</li>
{% else %}

View File

@ -14,7 +14,7 @@
{% for rack in page %}
<div style="display: inline-block; width: 266px">
<div class="rack_header">
<strong><a href="{% url 'dcim:rack' pk=rack.pk %}">{{ rack|truncatechars:"25" }}</a></strong>
<strong><a href="{% url 'dcim:rack' pk=rack.pk %}">{{ rack.name|truncatechars:"25" }}</a></strong>
<p><small class="text-muted">{{ rack.facility_id|truncatechars:"30" }}</small></p>
</div>
{% if face_id %}
@ -24,7 +24,7 @@
{% endif %}
<div class="clearfix"></div>
<div class="rack_header">
<strong><a href="{% url 'dcim:rack' pk=rack.pk %}">{{ rack|truncatechars:"25" }}</a></strong>
<strong><a href="{% url 'dcim:rack' pk=rack.pk %}">{{ rack.name|truncatechars:"25" }}</a></strong>
<p><small class="text-muted">{{ rack.facility_id|truncatechars:"30" }}</small></p>
</div>
</div>

View File

@ -1,5 +1,5 @@
<tr>
<td>{{ service }}</td>
<td>{{ service.name }}</td>
<td>
{{ service.get_protocol_display }}/{{ service.port }}
</td>

View File

@ -1,7 +1,7 @@
{% load secret_helpers %}
<tr>
<td><a href="{% url 'secrets:secret' pk=secret.pk %}">{{ secret.role }}</a></td>
<td>{{ secret }}</td>
<td>{{ secret.name }}</td>
<td id="secret_{{ secret.pk }}">********</td>
<td class="text-right">
{% if secret|decryptable_by:request.user %}