Relevés d'une caisse triéés par date desc

This commit is contained in:
Aurélien Delobelle 2016-08-23 03:00:09 +02:00
parent b6c75fd84a
commit 6a175eee08
2 changed files with 14 additions and 11 deletions

View file

@ -17,17 +17,15 @@
<div class="content-right-block">
<h2>Relevés</h2>
<div>
{% with statements=checkout.statements.all %}
{% if not statements %}
Pas de relevé
{% else %}
<ul>
{% for statement in statements %}
<li>{{ statement }}</li>
<li><a href="{% url 'kfet.checkoutstatement.update' checkout.pk statement.pk %}">{{ statement }}</a></li>
{% endfor %}
</ul>
{% endif %}
{% endwith %}
</div>
</div>
</div>

View file

@ -379,6 +379,11 @@ class CheckoutRead(DetailView):
template_name = 'kfet/checkout_read.html'
context_object_name = 'checkout'
def get_context_data(self, **kwargs):
context = super(CheckoutRead, self).get_context_data(**kwargs)
context['statements'] = context['checkout'].statements.order_by('-at')
return context
# Checkout - Update
class CheckoutUpdate(SuccessMessageMixin, UpdateView):