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

This commit is contained in:
jeremystretch
2022-12-15 16:21:30 -05:00
parent 6c08d73fa9
commit 2885656c99
2 changed files with 7 additions and 2 deletions

View File

@@ -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