mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-23 23:43:47 +00:00
Optimise le chargement des chambres
This commit is contained in:
parent
5034c2656c
commit
e17b28cae0
2 changed files with 9 additions and 6 deletions
|
@ -611,16 +611,19 @@ class Building(AclMixin, RevMixin, models.Model):
|
|||
"""Returns all ap of the building"""
|
||||
return AccessPoint.all_ap_in(self)
|
||||
|
||||
@cached_property
|
||||
def cached_name(self):
|
||||
return self.__str__()
|
||||
|
||||
def __str__(self):
|
||||
def get_name(self):
|
||||
if Dormitory.objects.count() > 1:
|
||||
return self.dormitory.name + " : " + self.name
|
||||
else:
|
||||
return self.name
|
||||
|
||||
@cached_property
|
||||
def cached_name(self):
|
||||
return self.get_name()
|
||||
|
||||
def __str__(self):
|
||||
return self.cached_name
|
||||
|
||||
|
||||
class Port(AclMixin, RevMixin, models.Model):
|
||||
""" Definition d'un port. Relié à un switch(foreign_key),
|
||||
|
|
|
@ -217,7 +217,7 @@ def index_port(request, switch, switchid):
|
|||
@can_view_all(Room)
|
||||
def index_room(request):
|
||||
""" Affichage de l'ensemble des chambres"""
|
||||
room_list = Room.objects
|
||||
room_list = Room.objects.select_related('building__dormitory')
|
||||
room_list = SortTable.sort(
|
||||
room_list,
|
||||
request.GET.get('col'),
|
||||
|
|
Loading…
Reference in a new issue