Refactor code
This commit is contained in:
parent
27c599f0a9
commit
343bc1fd84
6 changed files with 34 additions and 43 deletions
18
refunding/templates/refunding/elements_list.html
Normal file
18
refunding/templates/refunding/elements_list.html
Normal 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 %}
|
7
refunding/templates/refunding/payments.html
Normal file
7
refunding/templates/refunding/payments.html
Normal 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 %}
|
|
@ -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 %}
|
7
refunding/templates/refunding/refunds.html
Normal file
7
refunding/templates/refunding/refunds.html
Normal 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 %}
|
|
@ -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 %}
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue