Commit 35bf7fe6 authored by Hamza Dely's avatar Hamza Dely
Browse files

[consos/models] Ajoute une méthode pour présenter les soldes

parent f954e2d3
......@@ -141,7 +141,7 @@
</div>
<div class="card-text">
<dl class="row mx-auto my-2">
<dt class="col-4">Solde</dt><dd class="col-8">{{ object.note.solde }}</dd>
<dt class="col-4">Solde</dt><dd class="col-8">{{ object.note.get_solde_display() }}</dd>
<dt class="col-4">Fréquence des relevés de consommation</dt><dd class="col-8">{{ object.note.releve_freq|default("Jamais", true) }}</dd>
<dt class="col-4">Date du dernier relevé</dt><dd class="col-8">{{ object.note.dernier_releve|default("Jamais", true) }}</dd>
</dl>
......
......@@ -51,6 +51,9 @@ class Note(models.Model):
('note_hard_lock', "Bloquer la note d'un adhérent"),
]
def get_solde_display(self):
return "{} €".format(self.solde)
def __str__(self):
return str(self.adherent)
......
......@@ -51,7 +51,7 @@
<p class="font-weight-bold text-center">{{ request.user.pseudo }}</p>
</a>
{% if request.user.note %}
<p class="dropdown-item">Solde restant : <strong>{{ request.user.note.solde }}</strong></p>
<p class="dropdown-item">Solde restant : <strong>{{ request.user.note.get_solde_display() }}</strong></p>
{% endif %}
<a class="dropdown-item font-weight-bold text-center" href="{{ url('comptes:logout') }}">Déconnexion</a>
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment