Explicitly passing a date to a DateTimeField in a model's create method should override auto_now_add
|Reported by:||ian||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.3|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I'm writing some unit tests where I'm testing specific logic based on DateTimeFields in a model. When I use the .create() method on the model, I pass in a specific datetime to the DateTimeField but it gets ignored and overwritten by the auto_now_add functionality.
The only way I can do what I want is by first creating, then altering the value on the DateTimeField, then saving a second time to override.