Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Nounous
re2o
Commits
5acaa25c
Commit
5acaa25c
authored
Nov 19, 2016
by
Gabriel Detraz
Committed by
Simon Brélivet
Nov 19, 2016
Browse files
Bricoles, lacp pour les serveurs, retire l'unicité
parent
018f6c3e
Changes
4
Hide whitespace changes
Inline
Side-by-side
topologie/migrations/0020_auto_20161119_0033.py
0 → 100644
View file @
5acaa25c
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'topologie'
,
'0019_auto_20161026_1348'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'port'
,
name
=
'machine_interface'
,
field
=
models
.
ForeignKey
(
blank
=
True
,
to
=
'machines.Interface'
,
null
=
True
,
on_delete
=
django
.
db
.
models
.
deletion
.
SET_NULL
),
),
]
topologie/models.py
View file @
5acaa25c
...
...
@@ -24,7 +24,7 @@ class Switch(models.Model):
details
=
models
.
CharField
(
max_length
=
255
,
blank
=
True
)
def
__str__
(
self
):
return
str
(
self
.
location
)
return
str
(
self
.
location
)
+
' '
+
str
(
self
.
switch_interface
)
class
Port
(
models
.
Model
):
PRETTY_NAME
=
"Port de switch"
...
...
@@ -32,7 +32,7 @@ class Port(models.Model):
switch
=
models
.
ForeignKey
(
'Switch'
,
related_name
=
"ports"
)
port
=
models
.
IntegerField
()
room
=
models
.
ForeignKey
(
'Room'
,
on_delete
=
models
.
PROTECT
,
blank
=
True
,
null
=
True
)
machine_interface
=
models
.
OneToOneField
(
'machines.Interface'
,
on_delete
=
models
.
SET_NULL
,
blank
=
True
,
null
=
True
)
machine_interface
=
models
.
ForeignKey
(
'machines.Interface'
,
on_delete
=
models
.
SET_NULL
,
blank
=
True
,
null
=
True
)
related
=
models
.
OneToOneField
(
'self'
,
null
=
True
,
blank
=
True
,
related_name
=
'related_port'
)
details
=
models
.
CharField
(
max_length
=
255
,
blank
=
True
)
...
...
topologie/views.py
View file @
5acaa25c
...
...
@@ -103,18 +103,18 @@ def new_port(request, switch_id):
@
permission_required
(
'infra'
)
def
edit_port
(
request
,
port_id
):
try
:
port
=
Port
.
objects
.
get
(
pk
=
port_id
)
port
_object
=
Port
.
objects
.
get
(
pk
=
port_id
)
except
Port
.
DoesNotExist
:
messages
.
error
(
request
,
u
"Port inexistant"
)
return
redirect
(
"/topologie/"
)
port
=
EditPortForm
(
request
.
POST
or
None
,
instance
=
port
)
port
=
EditPortForm
(
request
.
POST
or
None
,
instance
=
port
_object
)
if
port
.
is_valid
():
with
transaction
.
atomic
(),
reversion
.
create_revision
():
port
.
save
()
reversion
.
set_user
(
request
.
user
)
reversion
.
set_comment
(
"Champs modifié(s) : %s"
%
', '
.
join
(
field
for
field
in
port
.
changed_data
))
messages
.
success
(
request
,
"Le port a bien été modifié"
)
return
redirect
(
"/topologie/
"
)
return
redirect
(
"/topologie/
switch/"
+
str
(
port_object
.
switch
.
id
)
)
return
form
({
'topoform'
:
port
},
'topologie/topo.html'
,
request
)
@
login_required
...
...
users/migrations/0039_auto_20161119_0033.py
0 → 100644
View file @
5acaa25c
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'users'
,
'0038_auto_20161031_0258'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'ldapserviceuser'
,
name
=
'dn'
,
field
=
models
.
CharField
(
serialize
=
False
,
max_length
=
200
,
primary_key
=
True
),
),
migrations
.
AlterField
(
model_name
=
'ldapuser'
,
name
=
'dn'
,
field
=
models
.
CharField
(
serialize
=
False
,
max_length
=
200
,
primary_key
=
True
),
),
migrations
.
AlterField
(
model_name
=
'ldapusergroup'
,
name
=
'dn'
,
field
=
models
.
CharField
(
serialize
=
False
,
max_length
=
200
,
primary_key
=
True
),
),
]
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