We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
datetime.now
timezone.now
People use timezone.now (sometimes even timezone.now()) as a default value. But, there are auto_now_add=True and auto_now=True for DateTimeField.
timezone.now()
auto_now_add=True
auto_now=True
DateTimeField
Sub-checks:
The text was updated successfully, but these errors were encountered:
timezone.now() is evaluated once, use timezone.now
this case is checked by fields.W161 https://docs.djangoproject.com/en/3.1/ref/checks/#model-fields
But, there are auto_now_add=True and auto_now=True for DateTimeField
auto keywords and default=timezone.now yield different results, so I'm not sure that we should have opinion about that.
default=timezone.now
Don't use datetime.now, it does not have a proper timezone support
that one looks like a good candidate for check
Sorry, something went wrong.
No branches or pull requests
People use
timezone.now
(sometimes eventimezone.now()
) as a default value.But, there are
auto_now_add=True
andauto_now=True
forDateTimeField
.Sub-checks:
timezone.now()
is evaluated once, usetimezone.now
datetime.now
, it does not have a proper timezone supportThe text was updated successfully, but these errors were encountered: