Customer accounts: Show event date in order list

This commit is contained in:
Raphael Michel
2022-12-15 14:30:15 +01:00
parent b31b2d34c0
commit d46989473b
2 changed files with 9 additions and 2 deletions

View File

@@ -91,6 +91,9 @@
</td>
<td>
{{ o.event }}
{% if not o.event.has_subevents and o.event.settings.show_dates_on_frontpage %}
<br><small class="text-muted">{{ o.event.get_date_range_display }}</small>
{% endif %}
</td>
<td>
{{ o.datetime|date:"SHORT_DATETIME_FORMAT" }}

View File

@@ -31,7 +31,9 @@ from django.contrib import messages
from django.core.exceptions import ValidationError
from django.core.signing import BadSignature, dumps, loads
from django.db import IntegrityError, transaction
from django.db.models import Count, IntegerField, OuterRef, Q, Subquery
from django.db.models import (
Count, IntegerField, OuterRef, Prefetch, Q, Subquery,
)
from django.http import Http404, HttpResponseRedirect
from django.shortcuts import get_object_or_404, redirect, render
from django.utils.crypto import get_random_string
@@ -355,7 +357,9 @@ class ProfileView(CustomerRequiredMixin, ListView):
q |= Q(email__iexact=self.request.customer.email)
qs = Order.objects.filter(
q
).select_related('event').order_by('-datetime')
).prefetch_related(
Prefetch('event', queryset=self.request.organizer.events.prefetch_related('_settings_objects'))
).order_by('-datetime')
return qs
def get_context_data(self, **kwargs):