Refactor code

This commit is contained in:
Gabriel Augendre 2016-06-04 02:01:33 +02:00
parent 27c599f0a9
commit 343bc1fd84
No known key found for this signature in database
GPG key ID: D2B6A5B41FC438B1
6 changed files with 34 additions and 43 deletions

View file

@ -0,0 +1,18 @@
{% if elements %}
{% if sum %}
<p>
Total : {{ sum }}€
</p>
{% endif %}
<div class="list-group">
{% for e in elements %}
<div class="list-group-item">
{{ e.title }} le {{ e.date|date:"SHORT_DATE_FORMAT" }} : {{ e.eur_value }}€
</div>
{% endfor %}
</div>
{% else %}
<p>
{% firstof default_nothing "Nothing here..." %}
</p>
{% endif %}

View file

@ -0,0 +1,7 @@
{% extends 'base.html' %}
{% load l10n %}
{% block content %}
<h1>{% block title %}Payments to refund{% endblock %}</h1>
{% include 'refunding/elements_list.html' with elements=payments %}
{% endblock %}

View file

@ -1,22 +0,0 @@
{% extends 'base.html' %}
{% load l10n %}
{% block content %}
<h1>{% block title %}Payments to refund{% endblock %}</h1>
{% if payments %}
<p>
Total : {{ sum }}€
</p>
<div class="list-group">
{% for payment in payments %}
<div class="list-group-item">
{{ payment.title }} le {{ payment.date|date:"SHORT_DATE_FORMAT" }} : {{ payment.eur_value }}€
</div>
{% endfor %}
</div>
{% else %}
<p>
{% firstof default_nothing "Nothing here..." %}
</p>
{% endif %}
{% endblock %}

View file

@ -0,0 +1,7 @@
{% extends 'base.html' %}
{% load l10n %}
{% block content %}
<h1>{% block title %}Latest refunds{% endblock %}</h1>
{% include 'refunding/elements_list.html' with elements=refunds %}
{% endblock %}

View file

@ -1,19 +0,0 @@
{% extends 'base.html' %}
{% load l10n %}
{% block content %}
<h1>{% block title %}Latest refunds{% endblock %}</h1>
{% if refunds %}
<div class="list-group">
{% for refund in refunds %}
<div class="list-group-item">
{{ refund.title }} le {{ refund.date|date:"SHORT_DATE_FORMAT" }} : {{ payment.amount }}€
</div>
{% endfor %}
</div>
{% else %}
<p>
{% firstof default_nothing "Nothing here..." %}
</p>
{% endif %}
{% endblock %}

View file

@ -13,7 +13,7 @@ def not_refunded_payments(request):
'sum': sum,
'default_nothing': 'No payment to be refunded.'
}
return render(request, "refunding/payments_list.html", context)
return render(request, "refunding/payments.html", context)
@login_required
@ -23,4 +23,4 @@ def latest_refunds(request):
'refunds': refunds,
'default_nothing': 'No refund to show.'
}
return render(request, "refunding/refunds_list.html", context)
return render(request, "refunding/refunds.html", context)