Sort All the Information by Date!


#1

I have a model named “Thing” as in the HelloWebApp book. Now I’ve added a “weight” model. The model has fields “date” and “weight_value”. While displaying the data in “thing_detail.html” I want to display the data ordered by the field “date”.

Here are my models.py and thing_details.html

Kindly someone help!

Thanks!


#2

This is what you need! https://docs.djangoproject.com/en/1.9/ref/models/querysets/#order-by


#3

Thanks that worked!