return node_cls.objects.filter(parent=self)
def parent(self):
- p = self.__dict__.get('_%s_cache' % name, None)
+ if (self.parent is not None) and self.parent.node_type == name:
+ return self.parent.leaf
- if p is None and (self.parent is not None) and self.parent.node_type == name:
- p = self.parent.leaf
- self.__dict__['_%s_cache' % name] = p
-
- return p
+ return None
Node.add_to_class(name + 's', property(children))
Node.add_to_class(name, property(parent))
@models.permalink
def get_absolute_url(self):
return ('question', (), {'id': self.id, 'slug': django_urlquote(slugify(self.title))})
+
+ def meta_description(self):
+ return self.summary
def get_revision_url(self):
return reverse('question_revisions', args=[self.id])
{% load humanize %}\r
{% load i18n %}\r
{% load cache %}\r
-{% block metadescription %}{{question.summary}}{% endblock %}\r
+{% block metadescription %}{{ question.meta_description }}{% endblock %}\r
{% block metakeywords %}{{question.tagname_meta_generator}}{% endblock %}\r
{% block meta %}\r
<link rel="canonical" href="{{settings.APP_URL}}{{question.get_absolute_url}}" />\r
@register.inclusion_tag("node/reviser_info.html")\r
def reviser_info(revision):\r
return {'revision': revision}\r
-\r
-\r