how to sort a for loop in django code example Example: for loop in django {% for i in range %} ... {% endfor %}