I use a queryset fields
in 2 places on my view.
One is ordered by another field, the other is ordered by facet. I'd like to order the dataset in 2 ways on the page, rather than passing the queryset twice.
I am trying to use dictsort to do this as is outlined here and a few other questions.
I have this in my code:
{% for field in fields|dictsort:"facet_order" %}
field.facet_order
{% endfor %}
But i see nothing rendered.
The loop works fine without the dictsort
, and as a sanity check i have run the below with no problem:
{% for field in fields %}
field.facet_order
{% endfor %}
It yields:
None None None None 1 0 None ...
My code looks to me like it strongly resembles django's documentation example below:
{% for book in books|dictsort:"author.age" %}
* {{ book.title }} ({{ book.author.name }})
{% endfor %}
What am i doing wrong here?