Skip to content

Commit

Permalink
fix(history): make history timezone aware
Browse files Browse the repository at this point in the history
Closes: #789
  • Loading branch information
b1rger committed Apr 16, 2024
1 parent ae2de71 commit c38d517
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apis_core/history/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from django.db.models import UniqueConstraint, Q
from django.db.models.functions import Lower
from django.contrib.contenttypes.models import ContentType
from django.utils import timezone


class APISHistoricalRecords(HistoricalRecords, GenericModel):
Expand Down Expand Up @@ -122,7 +123,7 @@ class Meta:

def save(self, *args, **kwargs) -> None:
if self._history_date is None:
self._history_date = datetime.now()
self._history_date = timezone.now()
return super().save(*args, **kwargs)

def delete(self, *args, **kwargs) -> tuple[int, dict[str, int]]:
Expand Down

0 comments on commit c38d517

Please sign in to comment.