Fixes #7193 - Fixes issue with viewing child prefixes when prefix (flat) column is selected and there are available prefixes.

This commit is contained in:
Daniel Sheppard 2021-09-07 14:53:12 -05:00
parent 27c0e6dd5e
commit 2fb55374b9
2 changed files with 14 additions and 4 deletions

View File

@ -7,6 +7,7 @@
* [#7153](https://github.com/netbox-community/netbox/issues/7153) - Allow clearing of assigned device type images * [#7153](https://github.com/netbox-community/netbox/issues/7153) - Allow clearing of assigned device type images
* [#7164](https://github.com/netbox-community/netbox/issues/7164) - Fix styling of "decommissioned" label for circuits * [#7164](https://github.com/netbox-community/netbox/issues/7164) - Fix styling of "decommissioned" label for circuits
* [#7169](https://github.com/netbox-community/netbox/issues/7169) - Fix CSV import file upload * [#7169](https://github.com/netbox-community/netbox/issues/7169) - Fix CSV import file upload
* [#7169](https://github.com/netbox-community/netbox/issues/7193) - Fix prefix (flat) template issue when viewing child prefixes with prefixes available
--- ---

View File

@ -25,6 +25,15 @@ PREFIX_LINK = """
<a href="{% if record.pk %}{% url 'ipam:prefix' pk=record.pk %}{% else %}{% url 'ipam:prefix_add' %}?prefix={{ record }}{% if object.vrf %}&vrf={{ object.vrf.pk }}{% endif %}{% if object.site %}&site={{ object.site.pk }}{% endif %}{% if object.tenant %}&tenant_group={{ object.tenant.group.pk }}&tenant={{ object.tenant.pk }}{% endif %}{% endif %}">{{ record.prefix }}</a> <a href="{% if record.pk %}{% url 'ipam:prefix' pk=record.pk %}{% else %}{% url 'ipam:prefix_add' %}?prefix={{ record }}{% if object.vrf %}&vrf={{ object.vrf.pk }}{% endif %}{% if object.site %}&site={{ object.site.pk }}{% endif %}{% if object.tenant %}&tenant_group={{ object.tenant.group.pk }}&tenant={{ object.tenant.pk }}{% endif %}{% endif %}">{{ record.prefix }}</a>
""" """
PREFIXFLAT_LINK = """
{% load helpers %}
{% if record.pk %}
<a href="{% url 'ipam:prefix' pk=record.pk %}">{{ record.prefix }}</a>
{% else %}
&mdash;
{% endif %}
"""
PREFIX_ROLE_LINK = """ PREFIX_ROLE_LINK = """
{% if record.role %} {% if record.role %}
<a href="{% url 'ipam:prefix_list' %}?role={{ record.role.slug }}">{{ record.role }}</a> <a href="{% url 'ipam:prefix_list' %}?role={{ record.role.slug }}">{{ record.role }}</a>
@ -281,10 +290,10 @@ class PrefixTable(BaseTable):
template_code=PREFIX_LINK, template_code=PREFIX_LINK,
attrs={'td': {'class': 'text-nowrap'}} attrs={'td': {'class': 'text-nowrap'}}
) )
prefix_flat = tables.Column( prefix_flat = tables.TemplateColumn(
accessor=Accessor('prefix'), template_code=PREFIXFLAT_LINK,
linkify=True, attrs={'td': {'class': 'text-nowrap'}},
verbose_name='Prefix (Flat)' verbose_name='Prefix (Flat)',
) )
depth = tables.Column( depth = tables.Column(
accessor=Accessor('_depth'), accessor=Accessor('_depth'),