django get latest object 1

django get latest object

Foo.objects.latest()

Here is what the above code is Doing:
1. Create a new Foo object.
2. Save it to the database.
3. Get the latest Foo object from the database.

The problem is that the latest object is not necessarily the one we just created.

Similar Posts