You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the issue
A clear and concise description of what the issue is.
I am using Django 5.0, and found what I think is a bug. This does not occur if i fall back to model_bakery 1.16.0, it was introduced in 1.17.0. I searched but I did not see anything on it. Apologies if i just missed it, or if this is expected behavior and I didn't see the changelog on it.
When using a Djano DateTimeField with auto_now_add=True like so:
created = models.DateTimeField(
auto_now_add=True, db_index=True, verbose_name=_("created")
)
The baker.make return does not match what is in the database.
Create any model with an auto_now_add time field. Then compare the output of the baker.make function with what is in the database. They do not match.
Expected behavior
I expect that the baker.make function returns an instance of the database object. I use this for comparisons with tests. When the datetime fields do not match, I have to look for the error.
Versions
Python: 3.11
Django 5.0
Model Bakery 1.17.0 (does not occur in 1.16.0)
The text was updated successfully, but these errors were encountered:
Describe the issue
A clear and concise description of what the issue is.
I am using Django 5.0, and found what I think is a bug. This does not occur if i fall back to model_bakery 1.16.0, it was introduced in 1.17.0. I searched but I did not see anything on it. Apologies if i just missed it, or if this is expected behavior and I didn't see the changelog on it.
When using a Djano DateTimeField with auto_now_add=True like so:
The baker.make return does not match what is in the database.
baker.make return:
{'_state': <django.db.models.base.ModelState object at 0x1158fb650>,
'created': datetime.datetime(2023, 12, 28, 18, 49, 21, 667003, tzinfo=datetime.timezone.utc),
}
objects.all()[0].dict return:
{'_state': <django.db.models.base.ModelState object at 0x1157bf990>,
'created': datetime.datetime(2023, 12, 28, 18, 49, 21, 666729, tzinfo=datetime.timezone.utc),
}
To Reproduce
Create any model with an auto_now_add time field. Then compare the output of the baker.make function with what is in the database. They do not match.
Expected behavior
I expect that the baker.make function returns an instance of the database object. I use this for comparisons with tests. When the datetime fields do not match, I have to look for the error.
Versions
The text was updated successfully, but these errors were encountered: