2π
β
You will need to add a timestamp field to your model. For example in my own code I add a date_updated field for this very purpose.
Your custom models donβt have this by default so you have to add it.
last_edit = models.DateTimeField(auto_now_add=True)
You will have to update this in the save method (or another method) of your model.
import datetime
self.last_edit = datetime.datetime.now()
π€mugurm
0π
If you have a field on your model that tracks this update time (more information on this here), then yes, you can just use that in a normal ordering specification.
If you donβt track updates on your model, no, that is not possible.
- [Answered ]-How to create a custom manager for related objects?
- [Answered ]-Object has no attribute 'get_notification_display'
- [Answered ]-Truncate items in dropdrown menu and selected item using javascript or jquery
- [Answered ]-Create additional model on activation django-registration
Source:stackexchange.com