Browse Source

Display a warning when trying to delete a user with active loan

Ref #30
Jocelyn Delalande 6 years ago
parent
commit
0753766ccc

+ 11 - 2
coin/members/templates/admin/members/member/delete_confirmation.html

@@ -1,14 +1,23 @@
 {% extends "admin/delete_confirmation.html" %}
 {% extends "admin/delete_confirmation.html" %}
 {% block content %}
 {% block content %}
-{% if object.get_recent_inactive_subscriptions.exists %}
 <ul class="messagelist">
 <ul class="messagelist">
+    {% if object.get_recent_inactive_subscriptions.exists %}
     <li class="warning">
     <li class="warning">
         Cet·te adhérent·e possède un service en cours ou résilié depuis moins
         Cet·te adhérent·e possède un service en cours ou résilié depuis moins
         d'un an. Légalement, il faut conserver sa fiche un an après la
         d'un an. Légalement, il faut conserver sa fiche un an après la
         résiliation du service.
         résiliation du service.
     </li>
     </li>
+    {% endif %}
+
+    {% if object.loans.running.exists %}
+    <li class="warning">
+        Cet·te adhérent·e possède du matériel non rendu :
+        {% for i in object.loans.running %}
+        {{ i.item }}{% if not forloop.last %}, {% endif %}.
+        {% endfor %}
+    </li>
+    {% endif %}
 </ul>
 </ul>
 
 
-{% endif %}
 {{ block.super }}
 {{ block.super }}
 {% endblock %}
 {% endblock %}