Skip to content
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

django.utils.timezone.utc was removed in Django 5.0 #4231

Conversation

cclauss
Copy link
Contributor

@cclauss cclauss commented Jan 22, 2024

https://docs.djangoproject.com/en/stable/releases/5.0/#features-removed-in-5-0

The django.utils.timezone.utc alias to datetime.timezone.utc is removed.

https://docs.djangoproject.com/en/stable/releases/4.1/#id2

The django.utils.timezone.utc alias to datetime.timezone.utc is deprecated. Use datetime.timezone.utc directly.

@cclauss cclauss changed the title django.utils.timezone.utc was remove in Django 5.0 django.utils.timezone.utc was removed in Django 5.0 Jan 22, 2024
Copy link

codecov bot commented Jan 22, 2024

Codecov Report

Merging #4231 (b6e6bd3) into master (8f57e5c) will not change coverage.
The diff coverage is n/a.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4231   +/-   ##
=======================================
  Coverage   87.84%   87.84%           
=======================================
  Files         291      291           
  Lines       16145    16145           
=======================================
  Hits        14182    14182           
  Misses       1963     1963           

@@ -1,4 +1,4 @@
from datetime import timedelta
from datetime import timedelta, timezone as datetime_timezone
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please do
from datetime.timezone import utc

Copy link
Contributor Author

@cclauss cclauss Jan 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not work. datetime is wired / weird that way.

% python3.12

Python 3.12.1 (main, Dec  7 2023, 20:45:44) [Clang 15.0.0 (clang-1500.1.0.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from datetime.timezone import utc
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'datetime.timezone'; 'datetime' is not a package

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay whatever this is in tests anyway so it does not really matter.

@cclauss cclauss closed this Jan 26, 2024
@cclauss cclauss deleted the django.utils.timezone.utc-removed-in-Django-5.0 branch January 26, 2024 14:08
@cclauss cclauss restored the django.utils.timezone.utc-removed-in-Django-5.0 branch January 26, 2024 14:50
@cclauss cclauss reopened this Jan 26, 2024
@cclauss cclauss force-pushed the django.utils.timezone.utc-removed-in-Django-5.0 branch from d406043 to 10a4d29 Compare January 26, 2024 14:52
@cclauss cclauss force-pushed the django.utils.timezone.utc-removed-in-Django-5.0 branch from 548389c to b6e6bd3 Compare January 26, 2024 16:18
@@ -1,4 +1,4 @@
from datetime import timedelta
from datetime import timedelta, timezone as datetime_timezone
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay whatever this is in tests anyway so it does not really matter.

@viggo-devries viggo-devries merged commit a9adfff into django-oscar:master Feb 15, 2024
23 checks passed
@cclauss cclauss deleted the django.utils.timezone.utc-removed-in-Django-5.0 branch February 15, 2024 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants