mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-26 09:16:10 -06:00
moved hide logic from template to python
This commit is contained in:
parent
49e4704bf7
commit
d8915b6d25
@ -227,6 +227,8 @@ class CustomFieldsMixin(models.Model):
|
|||||||
|
|
||||||
for cf in visible_custom_fields:
|
for cf in visible_custom_fields:
|
||||||
value = self.custom_field_data.get(cf.name)
|
value = self.custom_field_data.get(cf.name)
|
||||||
|
if not value and cf.ui_visibility == CustomFieldVisibilityChoices.VISIBILITY_HIDDEN_IFUNSET:
|
||||||
|
continue
|
||||||
value = cf.deserialize(value)
|
value = cf.deserialize(value)
|
||||||
groups[cf.group_name][cf] = value
|
groups[cf.group_name][cf] = value
|
||||||
|
|
||||||
|
@ -131,25 +131,21 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% for field, value in fields.items %}
|
{% for field, value in fields.items %}
|
||||||
{% if field.ui_visibility == 'hidden-ifunset' and not value %}
|
<tr>
|
||||||
<!-- Skip hidden fields -->
|
<th scope="row">{{ field }}
|
||||||
{% else %}
|
{% if field.description %}
|
||||||
<tr>
|
<i
|
||||||
<th scope="row">{{ field }}
|
class="mdi mdi-information text-primary"
|
||||||
{% if field.description %}
|
data-bs-toggle="tooltip"
|
||||||
<i
|
data-bs-placement="right"
|
||||||
class="mdi mdi-information text-primary"
|
title="{{ field.description|escape }}"
|
||||||
data-bs-toggle="tooltip"
|
></i>
|
||||||
data-bs-placement="right"
|
{% endif %}
|
||||||
title="{{ field.description|escape }}"
|
</th>
|
||||||
></i>
|
<td>
|
||||||
{% endif %}
|
{% customfield_value field value %}
|
||||||
</th>
|
</td>
|
||||||
<td>
|
</tr>
|
||||||
{% customfield_value field value %}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
@ -11,25 +11,21 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
<table class="table table-hover attr-table">
|
<table class="table table-hover attr-table">
|
||||||
{% for field, value in fields.items %}
|
{% for field, value in fields.items %}
|
||||||
{% if field.ui_visibility == 'hidden-ifunset' and not value %}
|
<tr>
|
||||||
<!-- Skip hidden fields -->
|
<th scope="row">{{ field }}
|
||||||
{% else %}
|
{% if field.description %}
|
||||||
<tr>
|
<i
|
||||||
<th scope="row">{{ field }}
|
class="mdi mdi-information text-primary"
|
||||||
{% if field.description %}
|
data-bs-toggle="tooltip"
|
||||||
<i
|
data-bs-placement="right"
|
||||||
class="mdi mdi-information text-primary"
|
title="{{ field.description|escape }}"
|
||||||
data-bs-toggle="tooltip"
|
></i>
|
||||||
data-bs-placement="right"
|
{% endif %}
|
||||||
title="{{ field.description|escape }}"
|
</th>
|
||||||
></i>
|
<td>
|
||||||
{% endif %}
|
{% customfield_value field value %}
|
||||||
</th>
|
</td>
|
||||||
<td>
|
</tr>
|
||||||
{% customfield_value field value %}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
Loading…
Reference in New Issue
Block a user