From 83f38e617b6215dd923107a94d9d41c8f664b25b Mon Sep 17 00:00:00 2001 From: klmp200 Date: Thu, 26 Apr 2018 19:38:39 +0200 Subject: [PATCH] Forum Form optimisation --- forum/models.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/forum/models.py b/forum/models.py index 75d4404d..8a79e6b6 100644 --- a/forum/models.py +++ b/forum/models.py @@ -31,6 +31,7 @@ from django.utils import timezone from django.utils.functional import cached_property from datetime import datetime +from itertools import chain import pytz from core.models import User, Group @@ -144,10 +145,7 @@ class Forum(models.Model): return "%s" % (self.name) def get_full_name(self): - name = '' - for parent in self.get_parent_list(): - name += parent.name + '/' - return name + self.name + return '/'.join(chain.from_iterable([[parent.name for parent in self.get_parent_list()], [self.name]])) def get_absolute_url(self): return reverse('forum:view_forum', kwargs={'forum_id': self.id})