datetime are time-zoned

This commit is contained in:
Yohann D'ANELLO 2020-05-05 13:54:26 +02:00
parent 72ca257bc3
commit f5367828ca
3 changed files with 7 additions and 7 deletions

View File

@ -1,5 +1,4 @@
import random
from datetime import timezone
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.models import AnonymousUser
@ -8,6 +7,7 @@ from django.db.models import Q
from django.http import FileResponse
from django.shortcuts import redirect
from django.urls import reverse_lazy
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from django.views import View
from django.views.generic import CreateView, UpdateView, DetailView, FormView

View File

@ -1,8 +1,8 @@
import os
from datetime import date, datetime
from django.db import models
from django.urls import reverse_lazy
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
@ -36,12 +36,12 @@ class Tournament(models.Model):
)
date_start = models.DateField(
default=datetime.today,
default=timezone.now().date(),
verbose_name=_("date start"),
)
date_end = models.DateField(
default=datetime.today,
default=timezone.now().date(),
verbose_name=_("date end"),
)
@ -75,7 +75,7 @@ class Tournament(models.Model):
)
year = models.PositiveIntegerField(
default=os.getenv("TFJM_YEAR", date.today().year),
default=os.getenv("TFJM_YEAR", timezone.now().year),
verbose_name=_("year"),
)
@ -153,7 +153,7 @@ class Team(models.Model):
)
year = models.PositiveIntegerField(
default=os.getenv("TFJM_YEAR", date.today().year),
default=os.getenv("TFJM_YEAR", timezone.now().year),
verbose_name=_("year"),
)

View File

@ -1,6 +1,5 @@
import random
import zipfile
from datetime import timezone
from io import BytesIO
from django.contrib.auth.mixins import LoginRequiredMixin
@ -11,6 +10,7 @@ from django.http import HttpResponse
from django.shortcuts import redirect
from django.template.loader import render_to_string
from django.urls import reverse_lazy
from django.utils import timezone
from django.utils.decorators import method_decorator
from django.utils.translation import gettext_lazy as _
from django.views import View