Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Prettify user order list

Marek Brzóska3df1ea953642
diff --git a/userprofile/templates/userprofile/orders.html b/userprofile/templates/userprofile/orders.html
index c6b3df4acc..a06d0622d5 100644
--- a/userprofile/templates/userprofile/orders.html
+++ b/userprofile/templates/userprofile/orders.html
@@ -1,5 +1,6 @@
{% extends "base.html" %}
{% load i18n %}
+{% load gross from prices %}
{% block content %}
@@ -7,22 +8,46 @@
<thead>
<tr>
<th>
- {% trans "Order token" %}
+ {% trans "Order" %}
+ </th>
+ <th>
+ {% trans "Price" %}
+ </th>
+ <th>
+ {% trans "Date" %}
+ </th>
+ <th>
+ {% trans "Last status change" %}
</th>
<th>
{% trans "Status" %}
</th>
+ <th>
+ <!-- details link -->
+ </th>
</tr>
</thead>
<tbody>
{% for order in orders %}
<tr>
<td>
- <a href="{{ order.get_absolute_url }}">{{ order.token }}</a>
+ {{ order }}
+ </td>
+ <td>
+ {% gross order.get_total %}
+ </td>
+ <td>
+ {{ order.created }}
+ </td>
+ <td>
+ {{ order.last_status_change }}
</td>
<td>
{{ order.get_status_display }}
</td>
+ <td>
+ <a href="{{ order.get_absolute_url }}">{% trans "See details" %}</a>
+ </td>
</tr>
{% endfor %}
</tbody>
diff --git a/userprofile/views.py b/userprofile/views.py
index 4bc7f183e2..64977cbf52 100755
--- a/userprofile/views.py
+++ b/userprofile/views.py
@@ -20,7 +20,7 @@ def details(request):
@login_required
def orders(request):
- ctx = {'orders': request.user.orders.all()}
+ ctx = {'orders': request.user.orders.prefetch_related('groups')}
return TemplateResponse(request, "userprofile/orders.html", ctx)