1👍
✅
Multiple fields can be passed to values_list, you must remove flat=True
.
This will return a tuple that can be iterated over in the template like so:
view:
charts = group_obj.chartgroup.values_list('chart_info_id', 'orderg').order_by('orderg', '-id')
context['assigned_charts'] = charts
template:
{% for chart, order in assigned_charts %}
Source:stackexchange.com