mirror of
				https://gitlab.crans.org/bde/nk20
				synced 2025-10-31 07:49:57 +01:00 
			
		
		
		
	default=timezone.default is better than auto_now_add=True
This commit is contained in:
		| @@ -5,6 +5,7 @@ from datetime import timedelta, datetime | ||||
| from django.contrib.auth.models import User | ||||
| from django.db import models | ||||
| from django.db.models import Q | ||||
| from django.utils import timezone | ||||
| from django.utils.translation import gettext_lazy as _ | ||||
| from rest_framework.exceptions import ValidationError | ||||
| from note.models import NoteUser, Transaction | ||||
| @@ -118,7 +119,7 @@ class Entry(models.Model): | ||||
|     ) | ||||
|  | ||||
|     time = models.DateTimeField( | ||||
|         auto_now_add=True, | ||||
|         default=timezone.now, | ||||
|         verbose_name=_("entry time"), | ||||
|     ) | ||||
|  | ||||
|   | ||||
| @@ -5,6 +5,7 @@ from django.conf import settings | ||||
| from django.contrib.contenttypes.models import ContentType | ||||
| from django.core.exceptions import ValidationError | ||||
| from django.db import models | ||||
| from django.utils import timezone | ||||
| from django.utils.translation import gettext_lazy as _ | ||||
|  | ||||
|  | ||||
| @@ -68,7 +69,7 @@ class Changelog(models.Model): | ||||
|     timestamp = models.DateTimeField( | ||||
|         null=False, | ||||
|         blank=False, | ||||
|         auto_now_add=True, | ||||
|         default=timezone.now, | ||||
|         name='timestamp', | ||||
|         verbose_name=_('timestamp'), | ||||
|     ) | ||||
|   | ||||
| @@ -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: | ||||
|   | ||||
| @@ -6,6 +6,7 @@ from django.contrib.auth.models import User | ||||
| from django.core.exceptions import ValidationError | ||||
| from django.db import models | ||||
| from django.db.models import Q | ||||
| from django.utils import timezone | ||||
| from django.utils.translation import gettext_lazy as _ | ||||
| from note.models import NoteSpecial, SpecialTransaction, MembershipTransaction | ||||
|  | ||||
| @@ -53,7 +54,7 @@ class Invoice(models.Model): | ||||
|     ) | ||||
|  | ||||
|     date = models.DateField( | ||||
|         auto_now_add=True, | ||||
|         default=timezone.now, | ||||
|         verbose_name=_("Place"), | ||||
|     ) | ||||
|  | ||||
| @@ -130,7 +131,7 @@ class Remittance(models.Model): | ||||
|     """ | ||||
|  | ||||
|     date = models.DateTimeField( | ||||
|         auto_now_add=True, | ||||
|         default=timezone.now, | ||||
|         verbose_name=_("Date"), | ||||
|     ) | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user