Browse Source

fix liste IPs dans l’espace adhérent

Élie Bouttier 7 years ago
parent
commit
02ce2371bf
2 changed files with 6 additions and 3 deletions
  1. 4 0
      services/models.py
  2. 2 3
      services/templates/services/service_detail.html

+ 4 - 0
services/models.py

@@ -168,6 +168,10 @@ class Service(models.Model):
     is_active.boolean = True
     is_active.short_description = 'Actif'
 
+    @property
+    def active_allocations(self):
+        return self.allocations.filter(get_active_filter())
+
     def get_absolute_url(self):
         return reverse('admin:%s_%s_change' % (self._meta.app_label, self._meta.model_name), args=(self.pk,))
 

+ 2 - 3
services/templates/services/service_detail.html

@@ -15,16 +15,15 @@
     </div>
     <div class="panel-body">
         <p>Identifiant du service : #{{ service.id }}</p>
-        <p>Responsable : {{ service.adhesion }}</p>
+        <p>Responsable : {{ service.adhesion }} {{ service.adhesion.adherent }}</p>
         {% if service.contribution %}
         <p>Contribution : {{ service.contribution }}</p>
         {% else %}
         <p>Contribution : pas de contribution</p>
         {% endif %}
-        <p>Actif : {{ service.is_active|yesno:"oui,non" }}</p>
         <p>
             IP allouée{{ service.active_allocations.count|pluralize }} :
-            {% for allocation in service.active_allocations %}
+            {% for allocation in service.active_allocations.all %}
             {% if forloop.first %}<ul>{% endif %}
                 <li>{{ allocation.resource }} (depuis le {{ allocation.start }})</li>
             {% if forloop.last %}</ul>{% endif %}