Make Page.specific and Page.specific_class cached properties

pull/372/head
Karl Hobley 2014-06-26 14:39:06 +01:00
rodzic d89398f214
commit a15939add6
1 zmienionych plików z 3 dodań i 2 usunięć

Wyświetl plik

@ -15,6 +15,7 @@ from django.contrib.auth.models import Group
from django.conf import settings
from django.template.response import TemplateResponse
from django.utils.translation import ugettext_lazy as _
from django.utils.functional import cached_property
from treebeard.mp_tree import MP_Node
@ -323,7 +324,7 @@ class Page(MP_Node, ClusterableModel, Indexed):
cursor.execute(update_statement,
[new_url_path, len(old_url_path) + 1, self.path + '%', self.id])
@property
@cached_property
def specific(self):
"""
Return this page in its most specific subclassed form.
@ -337,7 +338,7 @@ class Page(MP_Node, ClusterableModel, Indexed):
else:
return content_type.get_object_for_this_type(id=self.id)
@property
@cached_property
def specific_class(self):
"""
return the class that this page would be if instantiated in its