1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-06-21 09:58:23 +02:00

default=timezone.default is better than auto_now_add=True

This commit is contained in:
Yohann D'ANELLO
2020-08-01 17:49:23 +02:00
parent f38b9801d0
commit cc04fa5555
4 changed files with 9 additions and 5 deletions

View File

@ -7,6 +7,7 @@ from django.conf import settings
from django.core.exceptions import ValidationError
from django.core.validators import RegexValidator
from django.db import models
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from polymorphic.models import PolymorphicModel
@ -51,7 +52,7 @@ class Note(PolymorphicModel):
)
created_at = models.DateTimeField(
verbose_name=_('created at'),
auto_now_add=True,
default=timezone.now,
)
class Meta: