Bump Django to 4.1.* (#2989)

This commit is contained in:
Raphael Michel
2023-06-05 09:56:31 +02:00
committed by GitHub
parent 3a8556bb78
commit bd32b33ba9
119 changed files with 742 additions and 613 deletions
+1 -1
View File
@@ -19,7 +19,7 @@
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see
# <https://www.gnu.org/licenses/>.
#
from django.conf.urls import re_path
from django.urls import re_path
from pretix.api.urls import event_router
from pretix.plugins.badges.api import BadgeItemViewSet, BadgeLayoutViewSet
+1 -1
View File
@@ -19,7 +19,7 @@
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see
# <https://www.gnu.org/licenses/>.
#
from django.conf.urls import re_path
from django.urls import re_path
from pretix.api.urls import orga_router
from pretix.plugins.banktransfer.api import BankImportJobViewSet
+3 -3
View File
@@ -33,6 +33,7 @@
# 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
@@ -47,7 +48,6 @@ 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
@@ -513,7 +513,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, UTC)
last_checked_in = make_aware(last_checked_in, timezone.utc)
last_checked_out = None
if isinstance(op.last_checked_out, str): # SQLite
@@ -521,7 +521,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, UTC)
last_checked_out = make_aware(last_checked_out, timezone.utc)
row = [
op.order.code,
+1 -2
View File
@@ -19,8 +19,7 @@
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see
# <https://www.gnu.org/licenses/>.
#
from django.conf.urls import re_path
from django.urls import include
from django.urls import include, re_path
from .views import abort, oauth_disconnect, redirect_view, success
+5 -2
View File
@@ -29,7 +29,7 @@ from django.http import HttpRequest, HttpResponse
from django.template.loader import get_template
from django.urls import resolve
from django.utils.crypto import get_random_string
from django.utils.translation import gettext_lazy as _
from django.utils.translation import gettext_lazy as _, pgettext_lazy
from pretix.base.forms import SecretKeySettingsField
from pretix.base.middleware import _merge_csp, _parse_csp, _render_csp
@@ -61,7 +61,10 @@ def pretixcontrol_logentry_display(sender, logentry, **kwargs):
'PAYMENT.SALE.REFUNDED': _('Payment refunded.'),
'PAYMENT.SALE.REVERSED': _('Payment reversed.'),
'PAYMENT.SALE.PENDING': _('Payment pending.'),
'CHECKOUT.ORDER.APPROVED': _('Order approved.'),
'CHECKOUT.ORDER.APPROVED': pgettext_lazy('paypal', 'Order approved.'),
'CHECKOUT.ORDER.COMPLETED': pgettext_lazy('paypal', 'Order completed.'),
'PAYMENT.CAPTURE.COMPLETED': pgettext_lazy('paypal', 'Capture completed.'),
'PAYMENT.CAPTURE.PENDING': pgettext_lazy('paypal', 'Capture pending.'),
}
if event_type in plains:
+1 -2
View File
@@ -19,8 +19,7 @@
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see
# <https://www.gnu.org/licenses/>.
#
from django.conf.urls import re_path
from django.urls import include
from django.urls import include, re_path
from .views import (
PayView, XHRView, abort, isu_disconnect, isu_return, redirect_view,
+2 -3
View File
@@ -37,7 +37,6 @@ 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
@@ -123,7 +122,7 @@ class ReportlabExportMixin:
return 'report-%s.pdf' % self.event.slug, 'application/pdf', self.create(form_data)
def get_filename(self):
tz = pytz.timezone(self.event.settings.timezone)
tz = self.event.timezone
return "%s-%s.pdf" % (self.name, now().astimezone(tz).strftime("%Y-%m-%d-%H-%M-%S"))
@staticmethod
@@ -491,7 +490,7 @@ class OrderTaxListReportPDF(Report):
headlinestyle = self.get_style()
headlinestyle.fontSize = 15
headlinestyle.fontName = 'OpenSansBd'
tz = pytz.timezone(self.event.settings.timezone)
tz = self.event.timezone
tax_rates = set(
a for a
+1 -1
View File
@@ -19,7 +19,7 @@
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see
# <https://www.gnu.org/licenses/>.
#
from django.conf.urls import re_path
from django.urls import re_path
from .views import ReturnSettings
+10 -2
View File
@@ -21,6 +21,7 @@
#
from datetime import datetime, time, timedelta
from dateutil.tz import datetime_exists
from django.db import models
from django.db.models import Exists, OuterRef, Q
from django.utils import timezone
@@ -69,6 +70,9 @@ class ScheduledMail(models.Model):
def save(self, **kwargs):
if not self.computed_datetime:
self.recompute()
if 'update_fields' in kwargs:
kwargs['update_fields'] = {'computed_datetime', 'last_computed', 'state'}.union(kwargs['update_fields'])
super().save(**kwargs)
def recompute(self):
@@ -88,10 +92,14 @@ class ScheduledMail(models.Model):
base_time = (e.date_to or e.date_from) if self.rule.offset_to_event_end else e.date_from
d = base_time.astimezone(self.event.timezone).date() + offset
self.computed_datetime = make_aware(
datetime.combine(d, time(hour=st.hour, minute=st.minute, second=st.second, microsecond=0)),
datetime.combine(d, time(hour=st.hour, minute=st.minute, second=st.second, microsecond=0, fold=1)),
self.event.timezone,
is_dst=False, # prevent AmbiguousTimeError
)
if not datetime_exists(self.computed_datetime):
self.computed_datetime = make_aware(
datetime.combine(d, time(hour=st.hour, minute=st.minute, second=st.second, microsecond=0)) + timedelta(hours=1),
self.event.timezone,
)
if self.computed_datetime > timezone.now() and self.state == self.STATE_MISSED:
self.state = self.STATE_SCHEDULED
+1 -1
View File
@@ -32,7 +32,7 @@
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under the License.
from django.conf.urls import re_path
from django.urls import re_path
from pretix.api.urls import event_router
+1 -1
View File
@@ -19,7 +19,7 @@
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see
# <https://www.gnu.org/licenses/>.
#
from django.conf.urls import re_path
from django.urls import re_path
from . import views
+1 -2
View File
@@ -19,8 +19,7 @@
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see
# <https://www.gnu.org/licenses/>.
#
from django.conf.urls import re_path
from django.urls import include
from django.urls import include, re_path
from pretix.multidomain import event_url
+1 -1
View File
@@ -19,7 +19,7 @@
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see
# <https://www.gnu.org/licenses/>.
#
from django.conf.urls import re_path
from django.urls import re_path
from pretix.api.urls import event_router
from pretix.plugins.ticketoutputpdf.api import (
+1 -1
View File
@@ -19,7 +19,7 @@
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see
# <https://www.gnu.org/licenses/>.
#
from django.conf.urls import re_path
from django.urls import re_path
from .views import IndexView