From 4e2f426c1da557a6281c2a14ebbe0a90100aed20 Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Wed, 18 Apr 2018 21:26:57 +0200 Subject: [PATCH] Short name ap --- topologie/models.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/topologie/models.py b/topologie/models.py index 354c975d..7bfe3204 100644 --- a/topologie/models.py +++ b/topologie/models.py @@ -41,6 +41,7 @@ import itertools from django.db import models from django.db.models.signals import post_save, post_delete +from django.utils.functional import cached_property from django.dispatch import receiver from django.core.exceptions import ValidationError from django.db import IntegrityError @@ -123,6 +124,9 @@ class AccessPoint(AclMixin, Machine): def __str__(self): return str(self.interface_set.first()) + @cached_property + def short_name(self): + return str(self.interface_set.first().domain.name) class Switch(AclMixin, Machine): """ Definition d'un switch. Contient un nombre de ports (number),