update tenant column

This commit is contained in:
Alex Gittings 2022-03-15 13:34:14 +00:00
parent 018833bf6e
commit aa18281360
2 changed files with 13 additions and 1 deletions

View File

@ -220,7 +220,9 @@ class DeviceAssignTable(BaseTable):
verbose_name='Name'
)
status = ChoiceFieldColumn()
tenant = TenantColumn()
tenant = tables.TemplateColumn(
template_code=DEVICE_ASSIGN_TENANT
)
site = tables.Column()
location = tables.Column()
rack = tables.Column()

View File

@ -102,6 +102,16 @@ DEVICE_ASSIGN_LINK = """
<a href="{% url 'dcim:device_edit' pk=record.pk %}?rack={{ request.GET.rack }}&position={{ request.GET.position }}&site={{ request.GET.site }}&location={{ object.GET.location }}&face={{ request.GET.face }}&return_url={{ request.GET.return_url }}">{{ record }}</a>
"""
DEVICE_ASSIGN_TENANT = """
{% if record.tenant %}
{{ record.tenant }}
{% elif record.vrf.tenant %}
{{ record.vrf.tenant }}
{% else %}
&mdash;
{% endif %}
"""
#
# Device component buttons
#