Skip to content

Commit

Permalink
Replace usage of django.utils.timezone module (which was deprecated i…
Browse files Browse the repository at this point in the history
…n django 4.1 and removed in django>=5.0) with the python datetime module

    see django documentation here https://docs.djangoproject.com/en/dev/internals/deprecation/#deprecation-removed-in-5-0
  • Loading branch information
dpgraham4401 committed Dec 1, 2024
1 parent 4d5e94b commit 65f7d1a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dj_rest_auth/jwt_auth.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.utils import timezone
from datetime import timezone
from django.utils.translation import gettext_lazy as _
from rest_framework import status
from rest_framework import exceptions, serializers
Expand Down
6 changes: 3 additions & 3 deletions dj_rest_auth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from django.contrib.auth import login as django_login
from django.contrib.auth import logout as django_logout
from django.core.exceptions import ObjectDoesNotExist
from django.utils import timezone
from datetime import datetime
from django.utils.decorators import method_decorator
from django.utils.translation import gettext_lazy as _
from django.views.decorators.debug import sensitive_post_parameters
Expand Down Expand Up @@ -81,8 +81,8 @@ def get_response(self):
from rest_framework_simplejwt.settings import (
api_settings as jwt_settings,
)
access_token_expiration = (timezone.now() + jwt_settings.ACCESS_TOKEN_LIFETIME)
refresh_token_expiration = (timezone.now() + jwt_settings.REFRESH_TOKEN_LIFETIME)
access_token_expiration = (datetime.utcnow() + jwt_settings.ACCESS_TOKEN_LIFETIME)
refresh_token_expiration = (datetime.utcnow() + jwt_settings.REFRESH_TOKEN_LIFETIME)
return_expiration_times = api_settings.JWT_AUTH_RETURN_EXPIRATION
auth_httponly = api_settings.JWT_AUTH_HTTPONLY

Expand Down

0 comments on commit 65f7d1a

Please sign in to comment.