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
c92b6887
Commit
c92b6887
authored
Jan 11, 2019
by
Hugo LEVY-FALK
Committed by
chirac
Jan 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix radius options, force to set a vlan when adding a policy which requires it.
parent
3443965e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
preferences/forms.py
preferences/forms.py
+21
-0
No files found.
preferences/forms.py
View file @
c92b6887
...
...
@@ -231,6 +231,27 @@ class EditRadiusOptionForm(ModelForm):
model
=
RadiusOption
fields
=
'__all__'
def
clean
(
self
):
cleaned_data
=
super
().
clean
()
ignored
=
(
'radius_general_policy'
,
'vlan_decision_ok'
)
fields
=
(
f
for
f
in
self
.
fields
.
keys
()
if
'vlan'
not
in
f
and
f
not
in
ignored
)
for
f
in
fields
:
choice
=
cleaned_data
.
get
(
f
)
vlan
=
cleaned_data
.
get
(
f
+
'_vlan'
)
if
choice
==
RadiusOption
.
SET_VLAN
and
vlan
is
None
:
self
.
add_error
(
f
,
_
(
"You chose to set vlan but did not set any VLAN."
),
)
self
.
add_error
(
f
+
'_vlan'
,
_
(
"Please, choose a VLAN."
),
)
return
cleaned_data
class
ServiceForm
(
ModelForm
):
"""Edition, ajout de services sur la page d'accueil"""
...
...
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