From 7b53ed7578cc147feca2d2473409d0ebaeb791a6 Mon Sep 17 00:00:00 2001 From: Charlie Jacomme Date: Thu, 21 Jun 2018 21:00:09 +0200 Subject: [PATCH] short_name method for machine --- machines/models.py | 5 +++++ topologie/models.py | 4 ---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/machines/models.py b/machines/models.py index 17a5f122..bd9f7eb3 100644 --- a/machines/models.py +++ b/machines/models.py @@ -190,6 +190,11 @@ class Machine(RevMixin, FieldPermissionModelMixin, models.Model): "que les vĂ´tres") return True, None + @cached_property + def short_name(self): + return str(self.interface_set.first().domain.name) + + def __init__(self, *args, **kwargs): super(Machine, self).__init__(*args, **kwargs) self.field_permissions = { diff --git a/topologie/models.py b/topologie/models.py index e1c945c7..7c6865e2 100644 --- a/topologie/models.py +++ b/topologie/models.py @@ -127,10 +127,6 @@ class AccessPoint(AclMixin, Machine): switchbay__switch=self.switch() ) - @cached_property - def short_name(self): - return str(self.interface_set.first().domain.name) - @classmethod def all_ap_in(cls, building_instance): """Get a building as argument, returns all ap of a building"""