diff --git a/preferences/models.py b/preferences/models.py
index d08f761e..a6905d73 100644
--- a/preferences/models.py
+++ b/preferences/models.py
@@ -236,12 +236,18 @@ class OptionalTopologie(AclMixin, PreferencesModel):
help_text="Plage d'ip de management des switchs"
)
-
@cached_property
def provisioned_switchs(self):
+ """Liste des switches provisionnés"""
from topologie.models import Switch
return Switch.objects.filter(automatic_provision=True)
+ @cached_property
+ def provision_switchs_enabled(self):
+ """Return true if all settings are ok : switchs on automatic provision,
+ ip_type"""
+ return bool(self.provisioned_switchs and self.switchs_ip_type)
+
class Meta:
permissions = (
("view_optionaltopologie", "Peut voir les options de topologie"),
diff --git a/preferences/templates/preferences/display_preferences.html b/preferences/templates/preferences/display_preferences.html
index 76b144c0..36f4a001 100644
--- a/preferences/templates/preferences/display_preferences.html
+++ b/preferences/templates/preferences/display_preferences.html
@@ -123,9 +123,19 @@ with this program; if not, write to the Free Software Foundation, Inc.,
Rest management, activé si provision auto |
{{ topologieoptions.switchs_rest_management }} |
+
+
+
+
+ {% if topologieoptions.provision_switchs_enabled %}Provision de la config des switchs{% else %}Provision de la config des switchs{% endif%}
+
+
+ Switchs configurés automatiquement |
+ {{ topologieoptions.provisioned_switchs|join:", " }} {% if topologieoptions.provisioned_switchs %} OK{% else %}Manquant{% endif %} |
+
Plage d'ip de management des switchs |
- {{ topologieoptions.switchs_ip_type }} |
+ {{ topologieoptions.switchs_ip_type }} {% if topologieoptions.switchs_ip_type %} OK{% else %}Manquant{% endif %} |
@@ -135,14 +145,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% acl_end %}
{% include "preferences/aff_radiuskey.html" with radiuskey_list=radiuskey_list %}
- {% if topologieoptions.provisioned_switchs %}Provision de la config des switchs{% else %}Provision de la config des switchs{% endif%}
-
-
- Switchs configurés automatiquement |
- {{ topologieoptions.provisioned_switchs|join:", " }} |
-
-
-
Préférences generales