mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-10 00:03:24 +00:00
remove pytz
This commit is contained in:
parent
588a82426e
commit
e5a2236d72
@ -15,10 +15,10 @@
|
|||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
from datetime import timezone as tz
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
from urllib.parse import parse_qs
|
from urllib.parse import parse_qs
|
||||||
|
|
||||||
import pytz
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
@ -1439,10 +1439,10 @@ class CashSummaryListView(CounterAdminTabsMixin, CounterAdminMixin, ListView):
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
refillings = refillings.filter(
|
refillings = refillings.filter(
|
||||||
date__gte=datetime(year=1994, month=5, day=17, tzinfo=pytz.UTC)
|
date__gte=datetime(year=1994, month=5, day=17, tzinfo=tz.utc)
|
||||||
) # My birth date should be old enough
|
) # My birth date should be old enough
|
||||||
cashredistersummaries = cashredistersummaries.filter(
|
cashredistersummaries = cashredistersummaries.filter(
|
||||||
date__gte=datetime(year=1994, month=5, day=17, tzinfo=pytz.UTC)
|
date__gte=datetime(year=1994, month=5, day=17, tzinfo=tz.utc)
|
||||||
)
|
)
|
||||||
if form.is_valid() and form.cleaned_data["end_date"]:
|
if form.is_valid() and form.cleaned_data["end_date"]:
|
||||||
refillings = refillings.filter(date__lte=form.cleaned_data["end_date"])
|
refillings = refillings.filter(date__lte=form.cleaned_data["end_date"])
|
||||||
@ -1464,17 +1464,15 @@ class InvoiceCallView(CounterAdminTabsMixin, CounterAdminMixin, TemplateView):
|
|||||||
"""Add sums to the context"""
|
"""Add sums to the context"""
|
||||||
kwargs = super().get_context_data(**kwargs)
|
kwargs = super().get_context_data(**kwargs)
|
||||||
kwargs["months"] = Selling.objects.datetimes("date", "month", order="DESC")
|
kwargs["months"] = Selling.objects.datetimes("date", "month", order="DESC")
|
||||||
start_date = None
|
if "month" in self.request.GET:
|
||||||
end_date = None
|
|
||||||
try:
|
|
||||||
start_date = datetime.strptime(self.request.GET["month"], "%Y-%m")
|
start_date = datetime.strptime(self.request.GET["month"], "%Y-%m")
|
||||||
except:
|
else:
|
||||||
start_date = datetime(
|
start_date = datetime(
|
||||||
year=timezone.now().year,
|
year=timezone.now().year,
|
||||||
month=(timezone.now().month + 10) % 12 + 1,
|
month=(timezone.now().month + 10) % 12 + 1,
|
||||||
day=1,
|
day=1,
|
||||||
)
|
)
|
||||||
start_date = start_date.replace(tzinfo=pytz.UTC)
|
start_date = start_date.replace(tzinfo=tz.utc)
|
||||||
end_date = (start_date + timedelta(days=32)).replace(
|
end_date = (start_date + timedelta(days=32)).replace(
|
||||||
day=1, hour=0, minute=0, microsecond=0
|
day=1, hour=0, minute=0, microsecond=0
|
||||||
)
|
)
|
||||||
|
@ -23,9 +23,9 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
from datetime import timezone as tz
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
|
|
||||||
import pytz
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.db import models
|
from django.db import models
|
||||||
@ -437,7 +437,7 @@ class ForumUserInfo(models.Model):
|
|||||||
last_read_date = models.DateTimeField(
|
last_read_date = models.DateTimeField(
|
||||||
_("last read date"),
|
_("last read date"),
|
||||||
default=datetime(
|
default=datetime(
|
||||||
year=settings.SITH_SCHOOL_START_YEAR, month=1, day=1, tzinfo=pytz.UTC
|
year=settings.SITH_SCHOOL_START_YEAR, month=1, day=1, tzinfo=tz.utc
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
|
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
from datetime import timezone as tz
|
||||||
|
|
||||||
import pytz
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import DataError, transaction
|
from django.db import DataError, transaction
|
||||||
@ -79,7 +79,7 @@ class LaunderetteBookView(CanViewMixin, DetailView):
|
|||||||
self.subscriber = request.user
|
self.subscriber = request.user
|
||||||
if self.subscriber.is_subscribed:
|
if self.subscriber.is_subscribed:
|
||||||
self.date = dateparse.parse_datetime(request.POST["slot"]).replace(
|
self.date = dateparse.parse_datetime(request.POST["slot"]).replace(
|
||||||
tzinfo=pytz.UTC
|
tzinfo=tz.utc
|
||||||
)
|
)
|
||||||
if self.slot_type == "WASHING":
|
if self.slot_type == "WASHING":
|
||||||
if self.check_slot(self.slot_type):
|
if self.check_slot(self.slot_type):
|
||||||
@ -138,7 +138,7 @@ class LaunderetteBookView(CanViewMixin, DetailView):
|
|||||||
kwargs["planning"] = OrderedDict()
|
kwargs["planning"] = OrderedDict()
|
||||||
kwargs["slot_type"] = self.slot_type
|
kwargs["slot_type"] = self.slot_type
|
||||||
start_date = datetime.now().replace(
|
start_date = datetime.now().replace(
|
||||||
hour=0, minute=0, second=0, microsecond=0, tzinfo=pytz.UTC
|
hour=0, minute=0, second=0, microsecond=0, tzinfo=tz.utc
|
||||||
)
|
)
|
||||||
for date in LaunderetteBookView.date_iterator(
|
for date in LaunderetteBookView.date_iterator(
|
||||||
start_date, start_date + timedelta(days=6), timedelta(days=1)
|
start_date, start_date + timedelta(days=6), timedelta(days=1)
|
||||||
@ -158,7 +158,7 @@ class LaunderetteBookView(CanViewMixin, DetailView):
|
|||||||
free = True
|
free = True
|
||||||
elif self.slot_type == "DRYING" and self.check_slot("DRYING", h):
|
elif self.slot_type == "DRYING" and self.check_slot("DRYING", h):
|
||||||
free = True
|
free = True
|
||||||
if free and datetime.now().replace(tzinfo=pytz.UTC) < h:
|
if free and datetime.now().replace(tzinfo=tz.utc) < h:
|
||||||
kwargs["planning"][date].append(h)
|
kwargs["planning"][date].append(h)
|
||||||
else:
|
else:
|
||||||
kwargs["planning"][date].append(None)
|
kwargs["planning"][date].append(None)
|
||||||
@ -393,7 +393,7 @@ class ClickTokenForm(forms.BaseForm):
|
|||||||
slot.token = t
|
slot.token = t
|
||||||
slot.save()
|
slot.save()
|
||||||
t.user = subscriber
|
t.user = subscriber
|
||||||
t.borrow_date = datetime.now().replace(tzinfo=pytz.UTC)
|
t.borrow_date = datetime.now().replace(tzinfo=tz.utc)
|
||||||
t.save()
|
t.save()
|
||||||
price = settings.SITH_LAUNDERETTE_PRICES[t.type]
|
price = settings.SITH_LAUNDERETTE_PRICES[t.type]
|
||||||
s = Selling(
|
s = Selling(
|
||||||
|
15
poetry.lock
generated
15
poetry.lock
generated
@ -813,7 +813,6 @@ files = [
|
|||||||
{file = "libsass-0.22.0-cp37-abi3-macosx_10_15_x86_64.whl", hash = "sha256:081e256ab3c5f3f09c7b8dea3bf3bf5e64a97c6995fd9eea880639b3f93a9f9a"},
|
{file = "libsass-0.22.0-cp37-abi3-macosx_10_15_x86_64.whl", hash = "sha256:081e256ab3c5f3f09c7b8dea3bf3bf5e64a97c6995fd9eea880639b3f93a9f9a"},
|
||||||
{file = "libsass-0.22.0-cp37-abi3-win32.whl", hash = "sha256:89c5ce497fcf3aba1dd1b19aae93b99f68257e5f2026b731b00a872f13324c7f"},
|
{file = "libsass-0.22.0-cp37-abi3-win32.whl", hash = "sha256:89c5ce497fcf3aba1dd1b19aae93b99f68257e5f2026b731b00a872f13324c7f"},
|
||||||
{file = "libsass-0.22.0-cp37-abi3-win_amd64.whl", hash = "sha256:65455a2728b696b62100eb5932604aa13a29f4ac9a305d95773c14aaa7200aaf"},
|
{file = "libsass-0.22.0-cp37-abi3-win_amd64.whl", hash = "sha256:65455a2728b696b62100eb5932604aa13a29f4ac9a305d95773c14aaa7200aaf"},
|
||||||
{file = "libsass-0.22.0-cp38-abi3-macosx_14_0_arm64.whl", hash = "sha256:5fb2297a4754a6c8e25cfe5c015a3b51a2b6b9021b333f989bb8ce9d60eb5828"},
|
|
||||||
{file = "libsass-0.22.0.tar.gz", hash = "sha256:3ab5ad18e47db560f4f0c09e3d28cf3bb1a44711257488ac2adad69f4f7f8425"},
|
{file = "libsass-0.22.0.tar.gz", hash = "sha256:3ab5ad18e47db560f4f0c09e3d28cf3bb1a44711257488ac2adad69f4f7f8425"},
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -1346,17 +1345,6 @@ files = [
|
|||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
six = ">=1.5"
|
six = ">=1.5"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "pytz"
|
|
||||||
version = "2021.3"
|
|
||||||
description = "World timezone definitions, modern and historical"
|
|
||||||
optional = false
|
|
||||||
python-versions = "*"
|
|
||||||
files = [
|
|
||||||
{file = "pytz-2021.3-py2.py3-none-any.whl", hash = "sha256:3672058bc3453457b622aab7a1c3bfd5ab0bdae451512f6cf25f64ed37f5b87c"},
|
|
||||||
{file = "pytz-2021.3.tar.gz", hash = "sha256:acad2d8b20a1af07d4e4c9d2e9285c5ed9104354062f275f3fcd88dcef4f1326"},
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pyyaml"
|
name = "pyyaml"
|
||||||
version = "6.0.1"
|
version = "6.0.1"
|
||||||
@ -1382,7 +1370,6 @@ files = [
|
|||||||
{file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"},
|
{file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"},
|
||||||
{file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"},
|
{file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"},
|
||||||
{file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"},
|
{file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"},
|
||||||
{file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a08c6f0fe150303c1c6b71ebcd7213c2858041a7e01975da3a99aed1e7a378ef"},
|
|
||||||
{file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"},
|
{file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"},
|
||||||
{file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"},
|
{file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"},
|
||||||
{file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"},
|
{file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"},
|
||||||
@ -1881,4 +1868,4 @@ filelock = ">=3.4"
|
|||||||
[metadata]
|
[metadata]
|
||||||
lock-version = "2.0"
|
lock-version = "2.0"
|
||||||
python-versions = "^3.10"
|
python-versions = "^3.10"
|
||||||
content-hash = "51820883f41bdf40f00296b722ebdd9ac386e43ef1424ef990b29bac579ecbab"
|
content-hash = "7141b65a46fc8dda32aed5df6ca3873e40ff36f2fdb55f0e4732c58660738c52"
|
||||||
|
@ -26,7 +26,6 @@ Pillow = "^10.4.0"
|
|||||||
mistune = "^3.0.2"
|
mistune = "^3.0.2"
|
||||||
django-jinja = "^2.11"
|
django-jinja = "^2.11"
|
||||||
cryptography = "^42.0.8"
|
cryptography = "^42.0.8"
|
||||||
pytz = "^2021.1"
|
|
||||||
djangorestframework = "^3.13"
|
djangorestframework = "^3.13"
|
||||||
django-phonenumber-field = "^6.3"
|
django-phonenumber-field = "^6.3"
|
||||||
phonenumbers = "^8.12"
|
phonenumbers = "^8.12"
|
||||||
|
Loading…
Reference in New Issue
Block a user