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
38e25072
Commit
38e25072
authored
Jan 09, 2017
by
Dalahro
Committed by
root
Jan 09, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug réglé autocomplétion
parent
a4b4e33d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
machines/forms.py
machines/forms.py
+6
-5
machines/views.py
machines/views.py
+1
-1
No files found.
machines/forms.py
View file @
38e25072
...
...
@@ -70,11 +70,12 @@ class AliasForm(ModelForm):
def
__init__
(
self
,
*
args
,
**
kwargs
):
infra
=
kwargs
.
pop
(
'infra'
)
name_user
=
kwargs
.
pop
(
'name_user'
)
nb_machine
=
kwargs
.
pop
(
'nb_machine'
)
initial
=
kwargs
.
get
(
'initial'
,
{})
initial
[
'name'
]
=
name_user
.
lower
()
+
str
(
nb_machine
)
kwargs
[
'initial'
]
=
initial
if
'name_user'
in
kwargs
:
name_user
=
kwargs
.
pop
(
'name_user'
)
nb_machine
=
kwargs
.
pop
(
'nb_machine'
)
initial
=
kwargs
.
get
(
'initial'
,
{})
initial
[
'name'
]
=
name_user
.
lower
()
+
str
(
nb_machine
)
kwargs
[
'initial'
]
=
initial
super
(
AliasForm
,
self
).
__init__
(
*
args
,
**
kwargs
)
if
not
infra
:
self
.
fields
[
'extension'
].
queryset
=
Extension
.
objects
.
filter
(
need_infra
=
False
)
...
...
machines/views.py
View file @
38e25072
...
...
@@ -100,7 +100,7 @@ def new_machine(request, userid):
machine
=
NewMachineForm
(
request
.
POST
or
None
)
interface
=
AddInterfaceForm
(
request
.
POST
or
None
,
infra
=
request
.
user
.
has_perms
((
'infra'
,)))
nb_machine
=
Interface
.
objects
.
filter
(
machine__user
=
userid
).
count
()
domain
=
AliasForm
(
request
.
POST
or
None
,
infra
=
request
.
user
.
has_perms
((
'infra'
,)),
name_user
=
request
.
user
.
surname
,
nb_machine
=
nb_machine
)
domain
=
AliasForm
(
request
.
POST
or
None
,
infra
=
request
.
user
.
has_perms
((
'infra'
,)),
name_user
=
user
.
surname
,
nb_machine
=
nb_machine
)
if
machine
.
is_valid
()
and
interface
.
is_valid
():
new_machine
=
machine
.
save
(
commit
=
False
)
new_machine
.
user
=
user
...
...
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