forked from CGM_Public/pretix_original
Backend event list: Sort event series by their actual dates, like in the frontend (Z#23187301) (#4993)
This commit is contained in:
@@ -110,23 +110,26 @@
|
|||||||
{% if not hide_orga %}<td>{{ e.organizer }}</td>{% endif %}
|
{% if not hide_orga %}<td>{{ e.organizer }}</td>{% endif %}
|
||||||
<td class="event-date-col">
|
<td class="event-date-col">
|
||||||
{% if e.has_subevents %}
|
{% if e.has_subevents %}
|
||||||
{{ e.min_from|default_if_none:""|date:"SHORT_DATETIME_FORMAT" }}
|
<span class="fa fa-fw- fa-calendar"></span>
|
||||||
|
{% trans "Event series" %}
|
||||||
|
<br>
|
||||||
|
<span class="text-muted">
|
||||||
|
{% if e.min_from %}
|
||||||
|
{{ e.min_from|date:"SHORT_DATETIME_FORMAT" }} –<br>
|
||||||
|
{{ e.max_fromto|default_if_none:e.max_to|default_if_none:e.max_from|date:"SHORT_DATETIME_FORMAT" }}
|
||||||
|
{% else %}
|
||||||
|
{% trans "No dates" context "subevent" %}
|
||||||
|
{% endif %}
|
||||||
|
</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ e.get_short_date_from_display }}
|
{{ e.get_short_date_from_display }}
|
||||||
{% endif %}
|
{% if e.settings.show_date_to and e.date_to %}
|
||||||
{% if e.has_subevents %}
|
–<br>
|
||||||
<span class="label label-default">{% trans "Series" %}</span>
|
|
||||||
{% endif %}
|
|
||||||
{% if e.settings.show_date_to and e.date_to %}
|
|
||||||
–<br>
|
|
||||||
{% if e.has_subevents %}
|
|
||||||
{{ e.max_fromto|default_if_none:e.max_from|default_if_none:e.max_to|default_if_none:""|date:"SHORT_DATETIME_FORMAT" }}
|
|
||||||
{% else %}
|
|
||||||
{{ e.get_short_date_to_display }}
|
{{ e.get_short_date_to_display }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if e.settings.timezone != request.timezone %}
|
{% if e.settings.timezone != request.timezone %}
|
||||||
<span class="fa fa-globe text-muted" data-toggle="tooltip" title="{{ e.timezone }}"></span>
|
<span class="fa fa-globe text-muted" data-toggle="tooltip" title="{{ e.tzname }}"></span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
@@ -86,23 +86,26 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{% if e.has_subevents %}
|
{% if e.has_subevents %}
|
||||||
{{ e.min_from|default_if_none:""|date:"SHORT_DATETIME_FORMAT" }}
|
<span class="fa fa-fw- fa-calendar"></span>
|
||||||
|
{% trans "Event series" %}
|
||||||
|
<br>
|
||||||
|
<span class="text-muted">
|
||||||
|
{% if e.min_from %}
|
||||||
|
{{ e.min_from|date:"SHORT_DATETIME_FORMAT" }} –<br>
|
||||||
|
{{ e.max_fromto|default_if_none:e.max_to|default_if_none:e.max_from|date:"SHORT_DATETIME_FORMAT" }}
|
||||||
|
{% else %}
|
||||||
|
{% trans "No dates" context "subevent" %}
|
||||||
|
{% endif %}
|
||||||
|
</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ e.get_short_date_from_display }}
|
{{ e.get_short_date_from_display }}
|
||||||
{% endif %}
|
{% if e.settings.show_date_to and e.date_to %}
|
||||||
{% if e.has_subevents %}
|
–<br>
|
||||||
<span class="label label-default">{% trans "Series" %}</span>
|
|
||||||
{% endif %}
|
|
||||||
{% if e.settings.show_date_to and e.date_to %}
|
|
||||||
–<br>
|
|
||||||
{% if e.has_subevents %}
|
|
||||||
{{ e.max_fromto|default_if_none:e.max_from|default_if_none:e.max_to|default_if_none:""|date:"SHORT_DATETIME_FORMAT" }}
|
|
||||||
{% else %}
|
|
||||||
{{ e.get_short_date_to_display }}
|
{{ e.get_short_date_to_display }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if e.settings.timezone != request.timezone %}
|
{% if e.settings.timezone != request.timezone %}
|
||||||
<span class="fa fa-globe text-muted" data-toggle="tooltip" title="{{ e.timezone }}"></span>
|
<span class="fa fa-globe text-muted" data-toggle="tooltip" title="{{ e.tzname }}"></span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
@@ -81,9 +81,9 @@ class EventList(PaginationMixin, ListView):
|
|||||||
max_to=Max('subevents__date_to'),
|
max_to=Max('subevents__date_to'),
|
||||||
max_fromto=Greatest(Max('subevents__date_to'), Max('subevents__date_from'))
|
max_fromto=Greatest(Max('subevents__date_to'), Max('subevents__date_from'))
|
||||||
).annotate(
|
).annotate(
|
||||||
order_from=Coalesce('min_from', 'date_from'),
|
order_from=Coalesce('max_from', 'date_from'),
|
||||||
order_to=Coalesce('max_fromto', 'max_to', 'max_from', 'date_to', 'date_from'),
|
order_to=Coalesce('max_fromto', 'max_to', 'max_from', 'date_to', 'date_from'),
|
||||||
)
|
).order_by("-order_from")
|
||||||
|
|
||||||
qs = qs.prefetch_related(
|
qs = qs.prefetch_related(
|
||||||
Prefetch('quotas',
|
Prefetch('quotas',
|
||||||
|
|||||||
@@ -206,9 +206,9 @@ class OrganizerDetail(OrganizerDetailViewMixin, OrganizerPermissionRequiredMixin
|
|||||||
max_to=Max('subevents__date_to'),
|
max_to=Max('subevents__date_to'),
|
||||||
max_fromto=Greatest(Max('subevents__date_to'), Max('subevents__date_from'))
|
max_fromto=Greatest(Max('subevents__date_to'), Max('subevents__date_from'))
|
||||||
).annotate(
|
).annotate(
|
||||||
order_from=Coalesce('min_from', 'date_from'),
|
order_from=Coalesce('max_from', 'date_from'),
|
||||||
order_to=Coalesce('max_fromto', 'max_to', 'max_from', 'date_to', 'date_from'),
|
order_to=Coalesce('max_fromto', 'max_to', 'max_from', 'date_to', 'date_from'),
|
||||||
)
|
).order_by("-order_from")
|
||||||
if self.filter_form.is_valid():
|
if self.filter_form.is_valid():
|
||||||
qs = self.filter_form.filter_qs(qs)
|
qs = self.filter_form.filter_qs(qs)
|
||||||
return qs
|
return qs
|
||||||
|
|||||||
Reference in New Issue
Block a user