diff --git a/preferences/models.py b/preferences/models.py index 14ab9a52..68acf69e 100644 --- a/preferences/models.py +++ b/preferences/models.py @@ -225,12 +225,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", _("Can view the topology options")), diff --git a/preferences/templates/preferences/display_preferences.html b/preferences/templates/preferences/display_preferences.html index ccdfa4f0..4ab358c8 100644 --- a/preferences/templates/preferences/display_preferences.html +++ b/preferences/templates/preferences/display_preferences.html @@ -132,9 +132,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 %}