8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-25 22:03:10 +00:00

short_name method for machine

This commit is contained in:
Charlie Jacomme 2018-06-21 21:00:09 +02:00
parent eca223cdc4
commit 7b53ed7578
2 changed files with 5 additions and 4 deletions

View file

@ -190,6 +190,11 @@ class Machine(RevMixin, FieldPermissionModelMixin, models.Model):
"que les vôtres") "que les vôtres")
return True, None return True, None
@cached_property
def short_name(self):
return str(self.interface_set.first().domain.name)
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(Machine, self).__init__(*args, **kwargs) super(Machine, self).__init__(*args, **kwargs)
self.field_permissions = { self.field_permissions = {

View file

@ -127,10 +127,6 @@ class AccessPoint(AclMixin, Machine):
switchbay__switch=self.switch() switchbay__switch=self.switch()
) )
@cached_property
def short_name(self):
return str(self.interface_set.first().domain.name)
@classmethod @classmethod
def all_ap_in(cls, building_instance): def all_ap_in(cls, building_instance):
"""Get a building as argument, returns all ap of a building""" """Get a building as argument, returns all ap of a building"""