Revert "First steps into pytz deprecation"

This reverts commit e4e7d50659.
This commit is contained in:
Raphael Michel
2023-02-01 13:15:18 +01:00
parent e4e7d50659
commit 59d46ddded
63 changed files with 362 additions and 341 deletions

View File

@@ -33,7 +33,6 @@
# License for the specific language governing permissions and limitations under the License.
from collections import OrderedDict
from datetime import timezone
import bleach
import dateutil.parser
@@ -48,6 +47,7 @@ from django.utils.timezone import is_aware, make_aware, now
from django.utils.translation import (
gettext as _, gettext_lazy, pgettext, pgettext_lazy,
)
from pytz import UTC
from reportlab.lib.units import mm
from reportlab.platypus import Flowable, Paragraph, Spacer, Table, TableStyle
@@ -493,7 +493,7 @@ class CSVCheckinList(CheckInListMixin, ListExporter):
elif op.last_checked_in:
last_checked_in = op.last_checked_in
if last_checked_in and not is_aware(last_checked_in):
last_checked_in = make_aware(last_checked_in, timezone.utc)
last_checked_in = make_aware(last_checked_in, UTC)
last_checked_out = None
if isinstance(op.last_checked_out, str): # SQLite
@@ -501,7 +501,7 @@ class CSVCheckinList(CheckInListMixin, ListExporter):
elif op.last_checked_out:
last_checked_out = op.last_checked_out
if last_checked_out and not is_aware(last_checked_out):
last_checked_out = make_aware(last_checked_out, timezone.utc)
last_checked_out = make_aware(last_checked_out, UTC)
row = [
op.order.code,

View File

@@ -37,6 +37,7 @@ import tempfile
from collections import OrderedDict, defaultdict
from decimal import Decimal
import pytz
from dateutil.parser import parse
from django import forms
from django.conf import settings
@@ -82,7 +83,7 @@ class ReportlabExportMixin:
return 'report-%s.pdf' % self.event.slug, 'application/pdf', self.create(form_data)
def get_filename(self):
tz = self.event.timezone
tz = pytz.timezone(self.event.settings.timezone)
return "%s-%s.pdf" % (self.name, now().astimezone(tz).strftime("%Y-%m-%d-%H-%M-%S"))
@staticmethod
@@ -443,7 +444,7 @@ class OrderTaxListReportPDF(Report):
headlinestyle = self.get_style()
headlinestyle.fontSize = 15
headlinestyle.fontName = 'OpenSansBd'
tz = self.event.timezone
tz = pytz.timezone(self.event.settings.timezone)
tax_rates = set(
a for a