Add compat function for date.fromisocalendar for Python 3.6-3.7

This commit is contained in:
Raphael Michel
2020-10-12 11:30:11 +02:00
parent 3ec15fa529
commit 0105b9642d
3 changed files with 13 additions and 2 deletions

View File

@@ -29,6 +29,7 @@ from pretix.base.models.items import (
ItemBundle, SubEventItem, SubEventItemVariation,
)
from pretix.base.services.quotas import QuotaAvailability
from pretix.helpers.compat import date_fromisocalendar
from pretix.multidomain.urlreverse import eventreverse
from pretix.presale.ical import get_ical
from pretix.presale.signals import item_description
@@ -466,7 +467,7 @@ class EventIndex(EventViewMixin, EventListMixin, CartMixin, TemplateView):
) < 2
context['days'] = days_for_template(ebd, week)
context['weeks'] = [
(date.fromisocalendar(self.year, i + 1, 1), date.fromisocalendar(self.year, i + 1, 7))
(date_fromisocalendar(self.year, i + 1, 1), date_fromisocalendar(self.year, i + 1, 7))
for i in range(53 if date(self.year, 12, 31).isocalendar()[1] == 53 else 52)
]
context['years'] = range(now().year - 2, now().year + 3)