Opened 10 years ago
Closed 10 years ago
#24678 closed Bug (invalid)
auto_add and auto_add_now cannot be used together in DateTimeField definition
Description ¶
When I use auto_now=True in combination with auto_now_add=True on a models.DateTimeField I get the following error:
python manage.py check:
(fields.E160) The options auto_now, auto_now_add, and default are mutually exclusive. Only one of these options may be present.
See the attached project with a simple model illustrating this issue.
Change History (2)
by , 10 years ago
Attachment: | auto_now_add_test.zip added |
---|
comment:1 by , 10 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Yes, this was indeed enforced in #21798. The error message is right, you are not supposed to set both parameters. In your example use case, auto_now
is sufficient.
Simple Django 1.8 project with a single model illustrating this issue