mirror of
https://github.com/pretix/pretix.git
synced 2026-05-09 15:54:03 +00:00
Fix years with 52 weeks
This commit is contained in:
@@ -467,7 +467,7 @@ class EventIndex(EventViewMixin, EventListMixin, CartMixin, TemplateView):
|
|||||||
context['days'] = days_for_template(ebd, week)
|
context['days'] = days_for_template(ebd, week)
|
||||||
context['weeks'] = [
|
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)
|
for i in range(53 if date(self.year, 12, 31)[0] == self.year else 52)
|
||||||
]
|
]
|
||||||
context['years'] = range(now().year - 2, now().year + 3)
|
context['years'] = range(now().year - 2, now().year + 3)
|
||||||
context['week_format'] = get_format('WEEK_FORMAT')
|
context['week_format'] = get_format('WEEK_FORMAT')
|
||||||
|
|||||||
@@ -522,7 +522,10 @@ class WeekCalendarView(OrganizerViewMixin, EventListMixin, TemplateView):
|
|||||||
ebd = self._events_by_day(before, after)
|
ebd = self._events_by_day(before, after)
|
||||||
|
|
||||||
ctx['days'] = days_for_template(ebd, week)
|
ctx['days'] = days_for_template(ebd, week)
|
||||||
ctx['weeks'] = [(date.fromisocalendar(self.year, i + 1, 1), date.fromisocalendar(self.year, i + 1, 7)) for i in range(53)]
|
ctx['weeks'] = [
|
||||||
|
(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)[0] == self.year else 52)
|
||||||
|
]
|
||||||
ctx['years'] = range(now().year - 2, now().year + 3)
|
ctx['years'] = range(now().year - 2, now().year + 3)
|
||||||
ctx['week_format'] = get_format('WEEK_FORMAT')
|
ctx['week_format'] = get_format('WEEK_FORMAT')
|
||||||
if ctx['week_format'] == 'WEEK_FORMAT':
|
if ctx['week_format'] == 'WEEK_FORMAT':
|
||||||
|
|||||||
Reference in New Issue
Block a user