Commit 30140de2 authored by Gabriel Detraz's avatar Gabriel Detraz Committed by chirac

Des methodes raccourci pour mon gentil grizzly

parent f7b2e22d
......@@ -103,6 +103,23 @@ class AccessPoint(AclMixin, Machine):
("view_accesspoint", "Peut voir une borne"),
def switch(self):
"""Return the switch where this is plugged"""
return Switch.objects.filter(
def building(self):
"""Return the building of the AP (building of the switchs connected to...)"""
return Building.objects.filter(
def all_ap_in(cls, building_instance):
"""Get a building as argument, returns all ap of a building"""
return cls.objects.filter(interface__port__switch__switchbay__building=building_instance)
def __str__(self):
return str(self.interface_set.first())
Markdown is supported
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