Skip to content

Commit 66952f5

Browse files
committed
Make datetimes aware
1 parent 206b8f3 commit 66952f5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

python/nav/models/api.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from django.contrib.postgres.fields import HStoreField
2121
from django.db import models
2222
from django.urls import reverse
23+
from django.utils import djangotimezone
2324

2425
from nav.models.fields import VarcharField
2526
from nav.models.profiles import Account
@@ -84,7 +85,7 @@ def is_active(self) -> bool:
8485
`activates` is in the past and `expires` is in the future.
8586
"""
8687
now = datetime.now(tz=timezone.utc)
87-
return now >= self.activates and now < self.expires
88+
return djangotimezone.now() >= self.activates and now < self.expires
8889

8990
class Meta(object):
9091
db_table = 'jwtrefreshtoken'

0 commit comments

Comments
 (0)