Jan 27, 20219:48 AM - edited Jan 27, 20219:54 AM
Participant | Diamond Partner
Sort Repeater fields
Hi
Is there a way to sort repeater fields please?
We have created a repeater module with a date field in it, we would like the output to be dropped in asc/desc date order. We looked at the 'sort' filter but cannot get it to work -
{% for item in module.description|sort(False, False, 'date_field') %}
{{ item.date_field }}<br>
{{ item.name }}
{% endfor %}
The error we get is -
Error:Invalid argument in 'sort': 3rd argument with value 'date_field' must be a valid attribute of every item in the list
'module.description' is the group name for the repeater fields and there is data in the fields with zero empty fields. The code used above is not the exact code but a condensed version of it