diff options
Diffstat (limited to 'archaeological_finds')
-rw-r--r-- | archaeological_finds/forms_treatments.py | 8 | ||||
-rw-r--r-- | archaeological_finds/models_treatments.py | 6 |
2 files changed, 8 insertions, 6 deletions
diff --git a/archaeological_finds/forms_treatments.py b/archaeological_finds/forms_treatments.py index 6939e5e12..4cdbb941c 100644 --- a/archaeological_finds/forms_treatments.py +++ b/archaeological_finds/forms_treatments.py @@ -24,6 +24,7 @@ from collections import OrderedDict from bootstrap_datepicker.widgets import DateField from django import forms from django.core import validators +from django.utils import timezone from ishtar_common.utils import gettext_lazy as _ from ishtar_common.forms import FormHeader @@ -467,7 +468,8 @@ class QABasePackagingForm(IshtarForm): label=_("Year"), initial=lambda: datetime.datetime.now().year, validators=[validators.MinValueValidator(1000), validators.MaxValueValidator(2100)], required=False) - start_date = DateField(label=_("Precise date"), required=False, initial=lambda: datetime.datetime.today()) + start_date = DateField(label=_("Precise date"), required=False, + initial=lambda: datetime.date.today()) person = forms.IntegerField( label=_("Responsible"), widget=widgets.JQueryAutoComplete( @@ -809,10 +811,10 @@ class TreatmentFileForm(CustomForm, ManageOldType): widget=forms.Textarea, required=False) reception_date = DateField( label=_("Reception date"), required=False, - initial=lambda: datetime.datetime.now() + initial=lambda: timezone.now() ) creation_date = DateField(label=_("Start date"), required=False, - initial=lambda: datetime.datetime.now()) + initial=lambda: timezone.now()) end_date = DateField(label=_("End date"), required=False) TYPES = [ diff --git a/archaeological_finds/models_treatments.py b/archaeological_finds/models_treatments.py index b7b33fcfc..9d8e38bd2 100644 --- a/archaeological_finds/models_treatments.py +++ b/archaeological_finds/models_treatments.py @@ -31,8 +31,9 @@ from django.contrib.postgres.indexes import GinIndex from django.db.models import Max, Q from django.db.models.signals import post_save, post_delete, pre_delete, m2m_changed from django.template.defaultfilters import slugify +from django.utils import timezone from django.urls import reverse -from ishtar_common.utils import gettext_lazy as _, pgettext_lazy, SheetItem +from ishtar_common.utils import gettext_lazy as _, pgettext_lazy from archaeological_finds.models_finds import Find, FindBasket, TreatmentType, \ FindTreatment @@ -56,7 +57,6 @@ from ishtar_common.models import ( Person, post_save_cache, SearchVectorConfig, - ShortMenuItem, ValueGetter, ) from ishtar_common.models_common import CompleteIdentifierItem, HistoricalRecords @@ -421,7 +421,7 @@ class Treatment( goal = models.TextField(_("Goal"), blank=True, default="") start_date = models.DateField(_("Start date"), blank=True, null=True) end_date = models.DateField(_("End date"), blank=True, null=True) - creation_date = models.DateTimeField(default=datetime.datetime.now) + creation_date = models.DateTimeField(default=timezone.now) container = models.ForeignKey( Container, verbose_name=_("Container"), |