rename to OrderView instead of IndexView

This commit is contained in:
Richard Schreiber
2024-11-20 12:17:43 +01:00
parent 2c03468ef5
commit 2442f2bfb5
3 changed files with 79 additions and 3 deletions

View File

@@ -0,0 +1,76 @@
{% extends "pretixpresale/organizers/customer_base.html" %}
{% load i18n %}
{% load eventurl %}
{% load urlreplace %}
{% load money %}
{% load bootstrap3 %}
{% block title %}{% trans "Your account" %}{% endblock %}
{% block inner %}
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<span class="fa fa-shopping-cart" aria-hidden="true"></span> <b>{% trans "Orders" %}</b> ({{ page_obj.paginator.count }})
</h3>
</div>
<div class="panel-body">
{% if orders %}
<ol class="full-width-list alternating-rows">
{% for o in orders %}
<li class="row">
<dl>
<div class="col-md-4 col-sm-5 col-xs-8">
<dt class="sr-only">{% trans "Order" %}</dt>
<dd><strong>
<a href="{% abseventurl o.event "presale:event.order" order=o.code secret=o.secret %}" target="_blank">
<i class="fa fa-shopping-cart" aria-hidden="true"></i>
{{ o.code }}</a>
</strong>
{% if o.customer_id != customer.pk %}
<span class="fa fa-compress text-muted"
data-toggle="tooltip"
title="{% trans "Matched to the account based on the email address." %}"
></span>
{% endif %}
<small>{% include "pretixpresale/event/fragment_order_status.html" with order=o event=o.event %}</small>
</dd>
<dd><time datetime="{{ o.datetime|date:"Y-m-d H:i" }}" class="text-muted small">{{ o.datetime|date:"SHORT_DATETIME_FORMAT" }}</time></dd>
{% if o.testmode and False %}
<dd><span class="label label-warning">{% trans "TEST MODE" %}</span></dd>
{% endif %}
</div>
<div class="col-md-2 col-sm-2 col-xs-4 text-right">
<dt class="sr-only">{% trans "Order total" %}</dt>
<dd>{{ o.total|money:o.event.currency }}</dd>
<dt class="sr-only">{% trans "Positions" %}</dt>
<dd class="text-muted"><small>{% blocktranslate count counter=o.count_positions|default_if_none:0 %}{{ counter }} item{% plural %}{{ counter }} items{% endblocktranslate %}</small>
</dd>
</div>
<div class="col-md-4 col-sm-3 col-xs-8">
<dt class="sr-only">{% trans "Event" %}</dt>
<dd>
{{ 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 %}
</dd>
</div>
<div class="col-sm-2 col-xs-4">
<dt class="sr-only">{% trans "Actions" %}</dt>
<dd class="text-right">
<a href="{% abseventurl o.event "presale:event.order" order=o.code secret=o.secret %}"
target="_blank">
<span class="fa fa-list-ul" aria-hidden="true"></span>
{% trans "Details" %}
</a></dd>
</div>
</dl>
</li>
{% endfor %}
</ol>
{% else %}
<p class="text-center">{% trans "You dont have any orders in your account yet." %}</p>
{% endif %}
</div>
</div>
{% include "pretixcontrol/pagination.html" %}
{% endblock %}

View File

@@ -216,7 +216,7 @@ organizer_patterns = [
re_path(r'^account/addresses/(?P<id>\d+)/delete$', pretix.presale.views.customer.AddressDeleteView.as_view(), name='organizer.customer.address.delete'),
re_path(r'^account/profiles$', pretix.presale.views.customer.ProfileView.as_view(), name='organizer.customer.profiles'),
re_path(r'^account/profiles/(?P<id>\d+)/delete$', pretix.presale.views.customer.ProfileDeleteView.as_view(), name='organizer.customer.profile.delete'),
re_path(r'^account/$', pretix.presale.views.customer.IndexView.as_view(), name='organizer.customer.index'),
re_path(r'^account/$', pretix.presale.views.customer.OrderView.as_view(), name='organizer.customer.index'),
#re_path(r'^account/$', pretix.presale.views.customer.ProfileView.as_view(), name='organizer.customer.profile'),
re_path(r'^oauth2/v1/authorize$', pretix.presale.views.oidc_op.AuthorizeView.as_view(),

View File

@@ -350,8 +350,8 @@ class CustomerRequiredMixin:
return super().dispatch(request, *args, **kwargs)
class IndexView(CustomerRequiredMixin, ListView):
template_name = 'pretixpresale/organizers/customer_profile.html'
class OrderView(CustomerRequiredMixin, ListView):
template_name = 'pretixpresale/organizers/customer_orders.html'
context_object_name = 'orders'
paginate_by = 20