Skip to content

Commit

Permalink
Make datetimes aware
Browse files Browse the repository at this point in the history
  • Loading branch information
stveit committed Feb 4, 2025
1 parent 206b8f3 commit 2190bad
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion python/nav/models/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from django.contrib.postgres.fields import HStoreField
from django.db import models
from django.urls import reverse
from django.utils import timezone as djangotimezone

from nav.models.fields import VarcharField
from nav.models.profiles import Account
Expand Down Expand Up @@ -84,7 +85,7 @@ def is_active(self) -> bool:
`activates` is in the past and `expires` is in the future.
"""
now = datetime.now(tz=timezone.utc)
return now >= self.activates and now < self.expires
return djangotimezone.now() >= self.activates and now < self.expires

class Meta(object):
db_table = 'jwtrefreshtoken'

0 comments on commit 2190bad

Please sign in to comment.