mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 03:13:12 +00:00
Des methodes raccourci pour mon gentil grizzly
This commit is contained in:
parent
f7b2e22d3c
commit
30140de2ae
1 changed files with 17 additions and 0 deletions
|
@ -103,6 +103,23 @@ class AccessPoint(AclMixin, Machine):
|
||||||
("view_accesspoint", "Peut voir une borne"),
|
("view_accesspoint", "Peut voir une borne"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def switch(self):
|
||||||
|
"""Return the switch where this is plugged"""
|
||||||
|
return Switch.objects.filter(
|
||||||
|
ports__machine_interface__machine=self
|
||||||
|
)
|
||||||
|
|
||||||
|
def building(self):
|
||||||
|
"""Return the building of the AP (building of the switchs connected to...)"""
|
||||||
|
return Building.objects.filter(
|
||||||
|
switchbay__switch=self.switch()
|
||||||
|
)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
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):
|
def __str__(self):
|
||||||
return str(self.interface_set.first())
|
return str(self.interface_set.first())
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue