Просмотр исходного кода

netbox-community#10055 - Add template for NAT Outside

Fixes 'ipam.IPAddress.None' text
atownson 3 лет назад
Родитель
Сommit
3f40e15ed5
1 измененных файлов с 8 добавлено и 2 удалено
  1. 8 2
      netbox/ipam/tables/ip.py

+ 8 - 2
netbox/ipam/tables/ip.py

@@ -56,6 +56,12 @@ VRF_LINK = """
 {% endif %}
 {% endif %}
 """
 """
 
 
+NAT_OUTSIDE_LINK = """
+{% if record.nat_outside.count > 0 %}
+    {% for nat in record.nat_outside.all %}<a href="{{ nat.get_absolute_url }}">{{ nat.address.ip }}</a>{% if not forloop.last %}, {% endif %}{% endfor %}
+{% endif %}
+"""
+
 
 
 #
 #
 # RIRs
 # RIRs
@@ -360,8 +366,8 @@ class IPAddressTable(TenancyColumnsMixin, NetBoxTable):
         orderable=False,
         orderable=False,
         verbose_name='NAT (Inside)'
         verbose_name='NAT (Inside)'
     )
     )
-    nat_outside = tables.Column(
-        linkify=True,
+    nat_outside = tables.TemplateColumn(
+        template_code=NAT_OUTSIDE_LINK,
         orderable=False,
         orderable=False,
         verbose_name='NAT (Outside)'
         verbose_name='NAT (Outside)'
     )
     )