update displayed details about the invoice depending on payment date

Closes #5416
This commit is contained in:
Serghei Mihai 2014-09-18 17:52:57 +02:00
parent ac581f06bb
commit 1b4583f19c
2 changed files with 10 additions and 1 deletions

View File

@ -55,7 +55,15 @@
{{ invoice.creation_date|iso8601|date:"l j F Y" }}
{% if invoice.prelevement_automatique %}
<br />
Prélèvement automatique effectué le {{ invoice.expiration_date|iso8601|date:"l j F Y" }}
{% with expiration_date=invoice.expiration_date|iso8601 %}
Prélèvement automatique
{% if expiration_date < now %}
effectué
{% else %}
prévu
{% endif %}
le {{ expiration_date|date:"l j F Y" }}
{% endwith %}
{% endif %}
</p>

View File

@ -42,6 +42,7 @@ class InvoiceView(DetailView):
def get_context_data(self):
context = super(InvoiceView, self).get_context_data()
context['invoice'] = self.invoice
context.update({'now': datetime.datetime.now()})
return context
def get(self, request, *args, **kwargs):