~netlandish/django-wiki

c50e05f6b978281e22a6d85eceab26c321ec4e0e — benjaoming 11 years ago e25b3a4
Display a helping exception message when MPTT is failing
1 files changed, 7 insertions(+), 4 deletions(-)

M wiki/views/mixins.py
M wiki/views/mixins.py => wiki/views/mixins.py +7 -4
@@ 13,10 13,13 @@ class ArticleMixin(TemplateResponseMixin):
        self.article = article        
        self.children_slice = []
        if settings.SHOW_MAX_CHILDREN > 0:
            for child in self.article.get_children(max_num=settings.SHOW_MAX_CHILDREN+1,
                                                   articles__article__current_revision__deleted=False,
                                                   user_can_read=request.user):
                self.children_slice.append(child)
            try:
                for child in self.article.get_children(max_num=settings.SHOW_MAX_CHILDREN+1,
                                                       articles__article__current_revision__deleted=False,
                                                       user_can_read=request.user):
                    self.children_slice.append(child)
            except AttributeError, e:
                raise Exception("Attribute error most likely caused by wrong MPTT version. Use 0.5.3+.\n\n" + str(e))
        return super(ArticleMixin, self).dispatch(request, *args, **kwargs)

    def get_context_data(self, **kwargs):