python - 'latest' django model is not latest? -
using django 1.6:
getting model db using latest
returns model created
date on instance returned lacks microseconds, means it's not latest, has same date stamp, microseconds included , therefore later (boolean comparison of datetime.datetime
objects confirms it). what's going on?
mymodel(models.model): <lots of fields> created = models.datetimefield(auto_now_add=true)
and being retrieved with: latest = cls.objects.latest('created')
and:
latest.created datetime.datetime(2014, 11, 11, 17, 8, 43)
yet:
model_i_last_created.created datetime.datetime(2014, 11, 11, 17, 8, 43, 849155)
update: create 3 models using .create
1 returned latest
or last
first 1 created, not last.
Comments
Post a Comment