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

Closes #9971: Enable ordering of nested group models by name

jeremystretch 3 лет назад
Родитель
Сommit
9f15ca2d90
2 измененных файлов с 7 добавлено и 2 удалено
  1. 4 0
      docs/release-notes/version-3.4.md
  2. 3 2
      netbox/netbox/tables/columns.py

+ 4 - 0
docs/release-notes/version-3.4.md

@@ -2,6 +2,10 @@
 
 ## v3.4.1 (FUTURE)
 
+### Enhancements
+
+* [#9971](https://github.com/netbox-community/netbox/issues/9971) - Enable ordering of nested group models by name
+
 ### Bug Fixes
 
 * [#11175](https://github.com/netbox-community/netbox/issues/11175) - Fix cloning of fields containing special characters

+ 3 - 2
netbox/netbox/tables/columns.py

@@ -537,14 +537,15 @@ class MPTTColumn(tables.TemplateColumn):
     """
     template_code = """
         {% load helpers %}
-        {% for i in record.level|as_range %}<i class="mdi mdi-circle-small"></i>{% endfor %}
+        {% if not table.order_by %}
+          {% for i in record.level|as_range %}<i class="mdi mdi-circle-small"></i>{% endfor %}
+        {% endif %}
         <a href="{{ record.get_absolute_url }}">{{ record.name }}</a>
     """
 
     def __init__(self, *args, **kwargs):
         super().__init__(
             template_code=self.template_code,
-            orderable=False,
             attrs={'td': {'class': 'text-nowrap'}},
             *args,
             **kwargs