Change: treat created as date not datetime (#9793)

This commit is contained in:
shamoon
2025-05-16 07:23:04 -07:00
committed by GitHub
parent ce5d4e9c92
commit 1a6f32534c
18 changed files with 228 additions and 128 deletions

View File

@@ -213,7 +213,11 @@ class Document(SoftDeleteModel, ModelWithOwner):
),
)
created = models.DateTimeField(_("created"), default=timezone.now, db_index=True)
created = models.DateField(
_("created"),
default=datetime.datetime.today,
db_index=True,
)
modified = models.DateTimeField(
_("modified"),
@@ -291,8 +295,7 @@ class Document(SoftDeleteModel, ModelWithOwner):
verbose_name_plural = _("documents")
def __str__(self) -> str:
# Convert UTC database time to local time
created = datetime.date.isoformat(timezone.localdate(self.created))
created = self.created.isoformat()
res = f"{created}"
@@ -371,7 +374,7 @@ class Document(SoftDeleteModel, ModelWithOwner):
@property
def created_date(self):
return timezone.localdate(self.created)
return self.created
class SavedView(ModelWithOwner):