0

I am trying to sort objects passed to django, and I am passing them in like this:

{% for attendee in attendees|dictsort:"last_name" %}
     {{ attendee.first_name }} {{ attendee.last_name }}

dictsort isn't working though, because they are objects and not a dictionary. How do I sort these? The goal is to have an angularjs button that you can click and it will change the sorting parameter like: dictsort:{[{clickedTab}]}

Rob
  • 3,333
  • 5
  • 28
  • 71
  • I thinks this a duplicate see: http://stackoverflow.com/questions/12238939/sorting-objects-in-template – Diego Allen Dec 31 '15 at 03:14
  • If you use angular, you should push the object list on the scope as JSON and let angular handle the sorting. This way you only need to change the sort key in the scope. – Klaus D. Dec 31 '15 at 04:25

0 Answers0