Commit 2d7c9870 by Bridger Maxwell

children_slice is no longer queried when SHOW_MAX_CHILDREN=0

parent 55469f7b
...@@ -15,7 +15,7 @@ from wiki.core.exceptions import NoRootURL, MultipleRootURLs ...@@ -15,7 +15,7 @@ from wiki.core.exceptions import NoRootURL, MultipleRootURLs
from wiki.models.article import ArticleRevision, ArticleForObject, Article from wiki.models.article import ArticleRevision, ArticleForObject, Article
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
URLPATH_PREFECTED_PROPERTIES = ["parent", "article__current_revision"] URLPATH_PREFECTED_PROPERTIES = ["parent", "article__current_revision", "article__owner"]
class URLPath(MPTTModel): class URLPath(MPTTModel):
""" """
......
...@@ -12,9 +12,10 @@ class ArticleMixin(TemplateResponseMixin): ...@@ -12,9 +12,10 @@ class ArticleMixin(TemplateResponseMixin):
self.urlpath = kwargs.pop('urlpath', None) self.urlpath = kwargs.pop('urlpath', None)
self.article = article self.article = article
self.children_slice = [] self.children_slice = []
for child in self.article.get_children(max_num=settings.SHOW_MAX_CHILDREN+1, if settings.SHOW_MAX_CHILDREN > 0:
articles__article__current_revision__deleted=False): for child in self.article.get_children(max_num=settings.SHOW_MAX_CHILDREN+1,
self.children_slice.append(child) articles__article__current_revision__deleted=False):
self.children_slice.append(child)
return super(ArticleMixin, self).dispatch(request, *args, **kwargs) return super(ArticleMixin, self).dispatch(request, *args, **kwargs)
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment