vendredi 27 mars 2015

Timestamp before creating model instance not less than model instance creation timestamp django

I was perfoming some tests on some model so I created a variable before_creation = datetime.now()


My model has a field defined as


date_created = models.DateTimeField(auto_now_add=True)


During my tests this how am doing it


before_creation create_model_instance then test before_creation is less than mymodel.date_created, which in my thinking should pass, but its failing with the following message AssertionError: datetime.datetime (some timestamp) not less than datetime.datetime ((some other timestamp). Is this a bug? I have tried switching to timezone with no luck.


Aucun commentaire:

Enregistrer un commentaire