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
5dc21ea0
Commit
5dc21ea0
authored
Jul 22, 2018
by
klafyvel
Browse files
Merge branch 'fix_#131' into 'master'
Fix #131 Closes #131 See merge request federez/re2o!189
parents
14389470
2e6df9c2
Changes
2
Hide whitespace changes
Inline
Side-by-side
topologie/forms.py
View file @
5dc21ea0
...
...
@@ -87,15 +87,7 @@ class EditPortForm(FormRevMixin, ModelForm):
self
.
fields
[
'machine_interface'
].
queryset
=
(
Interface
.
objects
.
all
().
select_related
(
'domain__extension'
)
)
self
.
fields
[
'related'
].
queryset
=
(
Port
.
objects
.
all
()
.
prefetch_related
(
Prefetch
(
'switch__interface_set'
,
queryset
=
(
Interface
.
objects
.
select_related
(
'ipv4__ip_type__extension'
)
.
select_related
(
'domain__extension'
))
))
)
self
.
fields
[
'related'
].
queryset
=
Port
.
objects
.
all
().
prefetch_related
(
'switch__machine_ptr__interface_set__domain__extension'
)
class
AddPortForm
(
FormRevMixin
,
ModelForm
):
...
...
topologie/models.py
View file @
5dc21ea0
...
...
@@ -274,8 +274,12 @@ class Switch(AclMixin, Machine):
""" Returns the 'main' interface of the switch """
return
self
.
interface_set
.
first
()
@
cached_property
def
get_name
(
self
):
return
self
.
name
or
self
.
main_interface
().
domain
.
name
def
__str__
(
self
):
return
str
(
self
.
main_interface
()
)
return
str
(
self
.
get_name
)
class
ModelSwitch
(
AclMixin
,
RevMixin
,
models
.
Model
):
...
...
Write
Preview
Supports
Markdown
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