feat(access): remove mill-seconds from datetime auto fields

ref: #770 #759
This commit is contained in:
2025-05-21 00:49:42 +09:30
parent 9cb507286f
commit af2bc77920

View File

@ -1,6 +1,8 @@
from django.db import models
from django.utils.timezone import now
class AutoCreatedField(models.DateTimeField):
"""
A DateTimeField that automatically populates itself at
@ -49,7 +51,7 @@ class AutoLastModifiedField(AutoCreatedField):
def pre_save(self, model_instance, add):
value = now()
value = now().replace(microsecond=0)
setattr(model_instance, self.attname, value)