samedi 23 juillet 2016

Group django objects under a common date on the template

I have a django model that stores the orders placed by a user on a particular day. On his home page, I need to display the upcoming orders and group the orders which have the same date under one table/div tag.

For eg: All his orders for 15th june 2016 should come as

Order date: 15 june 2016
Order 1 details
order 2 details
...

I have a field order_date in my user-log model but how do i keep those with the same date together?

Aucun commentaire:

Enregistrer un commentaire