Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
re2o
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nounous
re2o
Commits
eded66be
Commit
eded66be
authored
Jul 09, 2018
by
Gabriel Detraz
Committed by
Grizzly
Sep 27, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gestion des switchs à provisioner automatiquement
parent
b44021a9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
2 deletions
+41
-2
preferences/forms.py
preferences/forms.py
+16
-2
preferences/models.py
preferences/models.py
+1
-0
topologie/migrations/0064_switch_automatic_provision.py
topologie/migrations/0064_switch_automatic_provision.py
+20
-0
topologie/models.py
topologie/models.py
+4
-0
No files found.
preferences/forms.py
View file @
eded66be
...
@@ -45,7 +45,6 @@ from .models import (
...
@@ -45,7 +45,6 @@ from .models import (
)
)
from
topologie.models
import
Switch
from
topologie.models
import
Switch
class
EditOptionalUserForm
(
ModelForm
):
class
EditOptionalUserForm
(
ModelForm
):
"""Formulaire d'édition des options de l'user. (solde, telephone..)"""
"""Formulaire d'édition des options de l'user. (solde, telephone..)"""
class
Meta
:
class
Meta
:
...
@@ -96,7 +95,14 @@ class EditOptionalMachineForm(ModelForm):
...
@@ -96,7 +95,14 @@ class EditOptionalMachineForm(ModelForm):
class
EditOptionalTopologieForm
(
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
(
Switch
.
objects
.
all
(),
required
=
False
)
class
Meta
:
class
Meta
:
model
=
OptionalTopologie
model
=
OptionalTopologie
fields
=
'__all__'
fields
=
'__all__'
...
@@ -114,6 +120,14 @@ class EditOptionalTopologieForm(ModelForm):
...
@@ -114,6 +120,14 @@ class EditOptionalTopologieForm(ModelForm):
self
.
fields
[
'vlan_decision_nok'
].
label
=
_
(
"VLAN for machines rejected"
self
.
fields
[
'vlan_decision_nok'
].
label
=
_
(
"VLAN for machines rejected"
" by RADIUS"
)
" by RADIUS"
)
self
.
initial
[
'automatic_provision_switchs'
]
=
Switch
.
objects
.
filter
(
automatic_provision
=
True
)
def
save
(
self
,
commit
=
True
):
instance
=
super
().
save
(
commit
)
Switch
.
objects
.
all
().
update
(
automatic_provision
=
False
)
self
.
cleaned_data
[
'automatic_provision_switchs'
].
update
(
automatic_provision
=
True
)
return
instance
class
EditGeneralOptionForm
(
ModelForm
):
class
EditGeneralOptionForm
(
ModelForm
):
"""Options générales (affichages de résultats de recherche, etc)"""
"""Options générales (affichages de résultats de recherche, etc)"""
...
...
preferences/models.py
View file @
eded66be
...
@@ -34,6 +34,7 @@ from django.forms import ValidationError
...
@@ -34,6 +34,7 @@ from django.forms import ValidationError
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.utils.translation
import
ugettext_lazy
as
_
import
machines.models
import
machines.models
from
re2o.mixins
import
AclMixin
from
re2o.mixins
import
AclMixin
from
re2o.aes_field
import
AESEncryptedField
from
re2o.aes_field
import
AESEncryptedField
from
datetime
import
timedelta
from
datetime
import
timedelta
...
...
topologie/migrations/0064_switch_automatic_provision.py
0 → 100644
View file @
eded66be
# -*- 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
=
[
migrations
.
AddField
(
model_name
=
'switch'
,
name
=
'automatic_provision'
,
field
=
models
.
BooleanField
(
default
=
False
,
help_text
=
'Provision automatique de ce switch'
),
),
]
topologie/models.py
View file @
eded66be
...
@@ -247,6 +247,10 @@ class Switch(AclMixin, Machine):
...
@@ -247,6 +247,10 @@ class Switch(AclMixin, Machine):
on_delete
=
models
.
PROTECT
,
on_delete
=
models
.
PROTECT
,
help_text
=
"Identifiant de management de ce switch"
help_text
=
"Identifiant de management de ce switch"
)
)
automatic_provision
=
models
.
BooleanField
(
default
=
False
,
help_text
=
'Provision automatique de ce switch'
,
)
class
Meta
:
class
Meta
:
unique_together
=
(
'stack'
,
'stack_member_id'
)
unique_together
=
(
'stack'
,
'stack_member_id'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment