From: hernani Date: Thu, 23 Sep 2010 23:27:07 +0000 (+0000) Subject: Some more tweaks and fixes. X-Git-Tag: live~536 X-Git-Url: https://git.openstreetmap.org./osqa.git/commitdiff_plain/0e419989be7dfc256a0ef8a39de3b3744257f9be?ds=inline Some more tweaks and fixes. git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@598 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- diff --git a/forum/models/node.py b/forum/models/node.py index 36fbda9..69c6396 100644 --- a/forum/models/node.py +++ b/forum/models/node.py @@ -78,13 +78,10 @@ class NodeMetaClass(BaseMetaClass): 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)) diff --git a/forum/models/question.py b/forum/models/question.py index 55f37c4..a185e02 100644 --- a/forum/models/question.py +++ b/forum/models/question.py @@ -44,6 +44,9 @@ class Question(Node): @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]) diff --git a/forum/skins/default/templates/question.html b/forum/skins/default/templates/question.html index 03ef8ee..1173ce9 100644 --- a/forum/skins/default/templates/question.html +++ b/forum/skins/default/templates/question.html @@ -8,7 +8,7 @@ {% load humanize %} {% load i18n %} {% load cache %} -{% block metadescription %}{{question.summary}}{% endblock %} +{% block metadescription %}{{ question.meta_description }}{% endblock %} {% block metakeywords %}{{question.tagname_meta_generator}}{% endblock %} {% block meta %} diff --git a/forum/templatetags/node_tags.py b/forum/templatetags/node_tags.py index 33bd45f..583b23c 100644 --- a/forum/templatetags/node_tags.py +++ b/forum/templatetags/node_tags.py @@ -208,5 +208,3 @@ def contributors_info(node): @register.inclusion_tag("node/reviser_info.html") def reviser_info(revision): return {'revision': revision} - -