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

View file

@ -379,6 +379,11 @@ class CheckoutRead(DetailView):
template_name = 'kfet/checkout_read.html' template_name = 'kfet/checkout_read.html'
context_object_name = 'checkout' 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 # Checkout - Update
class CheckoutUpdate(SuccessMessageMixin, UpdateView): class CheckoutUpdate(SuccessMessageMixin, UpdateView):