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

Fix unrestricted queries for Tags

Jeremy Stretch 5 лет назад
Родитель
Сommit
1ed152cd49

+ 1 - 1
netbox/templates/dcim/device.html

@@ -101,7 +101,7 @@
         </li>
         <li role="presentation"{% if active_tab == 'inventory' %} class="active"{% endif %}>
             <a href="{% url 'dcim:device_inventory' pk=device.pk %}">
-                Inventory <span class="badge">{{ device.inventoryitems.count }}</span>
+                Inventory <span class="badge">{{ device.inventoryitems.unrestricted.count }}</span>
             </a>
         </li>
         {% if perms.dcim.napalm_read_device %}

+ 1 - 1
netbox/templates/dcim/inc/interface.html

@@ -31,7 +31,7 @@
         {% if iface.description %}
             {{ iface.description }}<br/>
         {% endif %}
-        {% for tag in iface.tags.all %}
+        {% for tag in iface.tags.all.unrestricted %}
             {% tag tag %}
         {% empty %}
             {% if not iface.description %}&mdash;{% endif %}

+ 1 - 1
netbox/templates/extras/inc/tags_panel.html

@@ -4,7 +4,7 @@
         <strong>Tags</strong>
     </div>
     <div class="panel-body">
-        {% for tag in tags.all %}
+        {% for tag in tags.all.unrestricted %}
             {% tag tag url %}
         {% empty %}
             <span class="text-muted">No tags assigned</span>

+ 1 - 1
netbox/utilities/utils.py

@@ -215,7 +215,7 @@ def prepare_cloned_fields(instance):
 
     # Copy tags
     if is_taggable(instance):
-        params['tags'] = ','.join([t.name for t in instance.tags.all()])
+        params['tags'] = ','.join([t.name for t in instance.tags.all().unrestricted()])
 
     # Concatenate parameters into a URL query string
     param_string = '&'.join(