Commit ea5d02b1 authored by jeremystretch's avatar jeremystretch
Browse files

Remove deprecated display_name() methods from models

parent 58562753
......@@ -34,10 +34,11 @@ class RackElevationSVG:
@staticmethod
def _get_device_description(device):
return '{} ({}) — {} ({}U) {} {}'.format(
return '{} ({}) — {} {} ({}U) {} {}'.format(
device.name,
device.device_role,
device.device_type.display_name,
device.device_type.manufacturer.name,
device.device_type.model,
device.device_type.u_height,
device.asset_tag or '',
device.serial or ''
......
......@@ -320,10 +320,6 @@ class DeviceType(PrimaryModel):
if self.rear_image:
self.rear_image.delete(save=False)
@property
def display_name(self):
return f'{self.manufacturer.name} {self.model}'
@property
def is_parent_device(self):
return self.subdevice_role == SubdeviceRoleChoices.ROLE_PARENT
......@@ -622,7 +618,13 @@ class Device(PrimaryModel, ConfigContextModel):
)
def __str__(self):
return self.display_name or super().__str__()
if self.name:
return self.name
elif self.virtual_chassis:
return f'{self.virtual_chassis.name}:{self.vc_position} ({self.pk})'
elif self.device_type:
return f'{self.device_type.manufacturer} {self.device_type.model} ({self.pk})'
return super().__str__()
def get_absolute_url(self):
return reverse('dcim:device', args=[self.pk])
......@@ -823,17 +825,6 @@ class Device(PrimaryModel, ConfigContextModel):
self.comments,
)
@property
def display_name(self):
if self.name:
return self.name
elif self.virtual_chassis:
return f'{self.virtual_chassis.name}:{self.vc_position} ({self.pk})'
elif self.device_type:
return f'{self.device_type.manufacturer} {self.device_type.model} ({self.pk})'
else:
return '' # Device has not yet been created
@property
def identifier(self):
"""
......
......@@ -209,7 +209,9 @@ class Rack(PrimaryModel):
)
def __str__(self):
return self.display_name or super().__str__()
if self.facility_id:
return f'{self.name} ({self.facility_id})'
return self.name
def get_absolute_url(self):
return reverse('dcim:rack', args=[self.pk])
......@@ -277,12 +279,6 @@ class Rack(PrimaryModel):
else:
return reversed(range(1, self.u_height + 1))
@property
def display_name(self):
if self.facility_id:
return f'{self.name} ({self.facility_id})'
return self.name
def get_status_class(self):
return RackStatusChoices.CSS_CLASSES.get(self.status)
......
......@@ -172,7 +172,7 @@ class VLAN(PrimaryModel):
verbose_name_plural = 'VLANs'
def __str__(self):
return self.display_name or super().__str__()
return f'{self.name} ({self.vid})'
def get_absolute_url(self):
return reverse('ipam:vlan', args=[self.pk])
......@@ -199,10 +199,6 @@ class VLAN(PrimaryModel):
self.description,
)
@property
def display_name(self):
return f'{self.name} ({self.vid})'
def get_status_class(self):
return VLANStatusChoices.CSS_CLASSES.get(self.status)
......
......@@ -71,7 +71,9 @@ class VRF(PrimaryModel):
verbose_name_plural = 'VRFs'
def __str__(self):
return self.display_name or super().__str__()
if self.rd:
return f'{self.name} ({self.rd})'
return self.name
def get_absolute_url(self):
return reverse('ipam:vrf', args=[self.pk])
......@@ -85,12 +87,6 @@ class VRF(PrimaryModel):
self.description,
)
@property
def display_name(self):
if self.rd:
return f'{self.name} ({self.rd})'
return self.name
@extras_features('custom_fields', 'custom_links', 'export_templates', 'webhooks')
class RouteTarget(PrimaryModel):
......
......@@ -94,7 +94,7 @@
<tr>
<th scope="row">Device Type</th>
<td>
<span><a href="{{ object.device_type.get_absolute_url }}">{{ object.device_type.display_name }}</a> ({{ object.device_type.u_height }}U)</span>
<span><a href="{{ object.device_type.get_absolute_url }}">{{ object.device_type }}</a> ({{ object.device_type.u_height }}U)</span>
</td>
</tr>
<tr>
......@@ -356,7 +356,7 @@
<span class="text-muted">&mdash;</span>
{% endif %}
</td>
<td>{{ rd.device_type.display_name }}</td>
<td>{{ rd.device_type }}</td>
</tr>
{% endfor %}
</table>
......
......@@ -344,7 +344,7 @@
<a href="{% url 'dcim:device' pk=device.pk %}">{{ device }}</a>
</td>
<td>{{ device.device_role }}</td>
<td>{{ device.device_type.display_name }}</td>
<td>{{ device.device_type }}</td>
{% if device.parent_bay %}
<td><a href="{{ device.parent_bay.device.get_absolute_url }}">{{ device.parent_bay.device }}</a></td>
<td>{{ device.parent_bay }}</td>
......
......@@ -79,7 +79,7 @@
{% if object.vlan.group %}
<a href="{{ object.vlan.group.get_absolute_url }}">{{ object.vlan.group }}</a> /
{% endif %}
<a href="{% url 'ipam:vlan' pk=object.vlan.pk %}">{{ object.vlan.display_name }}</a>
<a href="{% url 'ipam:vlan' pk=object.vlan.pk %}">{{ object.vlan }}</a>
{% else %}
<span class="text-muted">None</span>
{% endif %}
......
......@@ -2,7 +2,7 @@
{% load helpers %}
{% load plugins %}
{% block title %}VLAN {{ object.display_name }}{% endblock %}
{% block title %}VLAN {{ object }}{% endblock %}
{% block breadcrumbs %}
<li class="breadcrumb-item">
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment