Looking through the django template tags, I found a good way to do this {{ifchanged}} , it is worth mentioning for future use.
My list of objects is passed to my template in alphabetical order:
Objects.get.all().order_by('title')
Then in my template I do:
# loop through all objects {% for obj in objs %}
This is a very convenient 1-line piece of code in the template.
source share