Commit eded66be authored by Gabriel Detraz's avatar Gabriel Detraz Committed by Grizzly
Browse files

Gestion des switchs à provisioner automatiquement

parent b44021a9
......@@ -45,7 +45,6 @@ from .models import (
from topologie.models import Switch
class EditOptionalUserForm(ModelForm):
"""Formulaire d'édition des options de l'user. (solde, telephone..)"""
class Meta:
......@@ -96,7 +95,14 @@ class EditOptionalMachineForm(ModelForm):
class EditOptionalTopologieForm(ModelForm):
"""Options de topologie, formulaire d'edition (vlan par default etc)"""
"""Options de topologie, formulaire d'edition (vlan par default etc)
On rajoute un champ automatic provision switchs pour gérer facilement
l'ajout de switchs au provisionning automatique"""
automatic_provision_switchs = forms.ModelMultipleChoiceField(
class Meta:
model = OptionalTopologie
fields = '__all__'
......@@ -114,6 +120,14 @@ class EditOptionalTopologieForm(ModelForm):
self.fields['vlan_decision_nok'].label = _("VLAN for machines rejected"
" by RADIUS")
self.initial['automatic_provision_switchs'] = Switch.objects.filter(automatic_provision=True)
def save(self, commit=True):
instance = super().save(commit)
return instance
class EditGeneralOptionForm(ModelForm):
"""Options générales (affichages de résultats de recherche, etc)"""
......@@ -34,6 +34,7 @@ from django.forms import ValidationError
from django.utils.translation import ugettext_lazy as _
import machines.models
from re2o.mixins import AclMixin
from re2o.aes_field import AESEncryptedField
from datetime import timedelta
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2018-09-20 16:28
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('topologie', '0063_auto_20180919_2225'),
operations = [
field=models.BooleanField(default=False, help_text='Provision automatique de ce switch'),
......@@ -247,6 +247,10 @@ class Switch(AclMixin, Machine):
help_text="Identifiant de management de ce switch"
automatic_provision = models.BooleanField(
help_text='Provision automatique de ce switch',
class Meta:
unique_together = ('stack', 'stack_member_id')
Supports Markdown
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