Commit 77b599ad authored by chirac's avatar chirac Committed by Gabriel Detraz
Browse files

fix: the function all_ap_in doesn't crash anymore on dormitory use

parent 3d365a48
......@@ -129,17 +129,17 @@ class AccessPoint(Machine):
return str(self.interface_set.first()
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.
building_instance: the building used to find APs.
building_set: the building set used to find APs.
The queryset of all APs in the given building.
The queryset of all APs in the given building set.
return cls.objects.filter(
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(
def get_name(self):
if Dormitory.is_multiple_dorms():
......@@ -1331,7 +1331,7 @@ def make_machine_graph():
{"numero": port.port, "related": port.related.switch.get_name}
for ap in AccessPoint.all_ap_in(building).prefetch_related(
for ap in building.all_ap_in().prefetch_related(
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment