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
Re2o
re2o
Commits
77b599ad
Commit
77b599ad
authored
Jan 24, 2021
by
chirac
Committed by
Gabriel Detraz
Jan 24, 2021
Browse files
fix: the function all_ap_in doesn't crash anymore on dormitory use
parent
3d365a48
Changes
2
Hide whitespace changes
Inline
Side-by-side
topologie/models.py
View file @
77b599ad
...
...
@@ -129,17 +129,17 @@ class AccessPoint(Machine):
return
str
(
self
.
interface_set
.
first
().
domain
.
name
)
@
classmethod
def
all_ap_in
(
cls
,
building_
instance
):
"""Get all the APs of the given building.
def
all_ap_in
(
cls
,
building_
set
):
"""Get all the APs of the given building
set
.
Args:
building_
instance
: the building used to find APs.
building_
set
: the building
set
used to find APs.
Returns:
The queryset of all APs in the given building.
The queryset of all APs in the given building
set
.
"""
return
cls
.
objects
.
filter
(
interface__port__switch__switchbay__building
=
building_
instance
interface__port__switch__switchbay__building
__in
=
building_
set
)
def
__str__
(
self
):
...
...
@@ -770,7 +770,7 @@ class Building(AclMixin, RevMixin, models.Model):
def
all_ap_in
(
self
):
"""Get all the APs in the building."""
return
AccessPoint
.
all_ap_in
(
self
)
return
AccessPoint
.
all_ap_in
(
Building
.
objects
.
filter
(
id
=
self
.
id
)
)
def
get_name
(
self
):
if
Dormitory
.
is_multiple_dorms
():
...
...
topologie/views.py
View file @
77b599ad
...
...
@@ -1331,7 +1331,7 @@ def make_machine_graph():
{
"numero"
:
port
.
port
,
"related"
:
port
.
related
.
switch
.
get_name
}
)
for
ap
in
AccessPo
in
t
.
all_ap_in
(
building
).
prefetch_related
(
for
ap
in
build
in
g
.
all_ap_in
().
prefetch_related
(
Prefetch
(
"interface_set"
,
queryset
=
(
...
...
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