-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix USE_TZ RemovedInDjango50Warning #1573
New issue
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
Conversation
Okay looks like the test suite needs adjustment... |
list(User.objects.filter(date_joined=datetime.datetime(2017, 12, 22, 16, 7, 1))) | ||
list( | ||
User.objects.filter( | ||
date_joined=datetime.datetime( | ||
2017, 12, 22, 16, 7, 1, tzinfo=datetime.timezone.utc | ||
) | ||
) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change from naive datetime, which django will interpret with the default timezone, to aware
|
||
DATA = {"value": "foo", "date": datetime(2020, 1, 1)} | ||
SIGNED_DATA = f'{{"date": "2020-01-01 00:00:00", "value": "foo"}}:{SIGNATURE}' | ||
DATA = {"value": "foo", "date": datetime(2020, 1, 1, tzinfo=timezone.utc)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, this changes the naive datetime to aware, so that it isn't interpreted with the default timezone when converting to str
if connection.vendor == "postgresql": | ||
# PostgreSQL always includes timezone | ||
expected_datetime = '["2017-12-22 16:07:01+00:00"]' | ||
else: | ||
expected_datetime = '["2017-12-22 16:07:01"]' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new formatting difference being triggered on PostgreSQL
Fix this warning, which appears in both the docs build and Django 4.0 tests: ``` /.../python3.8/site-packages/django/conf/__init__.py:199: RemovedInDjango50Warning: The default value of USE_TZ will change from False to True in Django 5.0. Set USE_TZ to False in your project settings if you want to keep the current default behavior. ```
Very nice, thanks! |
Fix this warning, which appears in both the docs build and Django 4.0 tests: ``` /.../python3.8/site-packages/django/conf/__init__.py:199: RemovedInDjango50Warning: The default value of USE_TZ will change from False to True in Django 5.0. Set USE_TZ to False in your project settings if you want to keep the current default behavior. ```
Fix this warning, which appears in both the docs build and Django 4.0 tests: