Skip to content

Commit 243d549

Browse files
authored
Fixes: #313 - Cap related custom objects table size (#314)
1 parent 436322d commit 243d549

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

netbox_custom_objects/template_content.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,20 @@ def left_page(self):
7777
<th>Field</th>
7878
</tr>
7979
</thead>
80-
{% for obj in linked_custom_objects %}
81-
<tr>
82-
<td>{{ obj.field.custom_object_type }}</td>
83-
<th scope="row"><a href="{{ obj.custom_object.get_absolute_url() }}">{{ obj.custom_object }}</a></th>
84-
<td>{{ obj.field }}</td>
85-
</tr>
86-
{% endfor %}
80+
{% if linked_custom_objects|count <= 20 %}
81+
{% for obj in linked_custom_objects %}
82+
<tr>
83+
<td>{{ obj.field.custom_object_type }}</td>
84+
<th scope="row">
85+
<a href="{{ obj.custom_object.get_absolute_url() }}">{{ obj.custom_object }}</a>
86+
</th>
87+
<td>{{ obj.field }}</td>
88+
</tr>
89+
{% endfor %}
90+
{% endif %}
91+
<tr>
92+
<td colspan="3">{{ linked_custom_objects|count }} objects</td>
93+
</tr>
8794
</table>
8895
</div>
8996
""",

0 commit comments

Comments
 (0)