]> git.openstreetmap.org Git - osqa.git/commitdiff
Some more tweaks and fixes.
authorhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Thu, 23 Sep 2010 23:27:07 +0000 (23:27 +0000)
committerhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Thu, 23 Sep 2010 23:27:07 +0000 (23:27 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@598 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/models/node.py
forum/models/question.py
forum/skins/default/templates/question.html
forum/templatetags/node_tags.py

index 36fbda9d9be9eef4162562b913735434311b80b0..69c6396a4bc2cd9e26c5e86360172c3b41c13c76 100644 (file)
@@ -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))
index 55f37c47ca787ec207b992622141463983d23884..a185e026bd623d56e0edb4d392ab9f2af95571db 100644 (file)
@@ -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])
index 03ef8eede5bd68c61db103d017561b93aff9ff2d..1173ce94726a36782af95cde7057fcc7e1d2d0c8 100644 (file)
@@ -8,7 +8,7 @@
 {% 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
index 33bd45fdf97aa6a76df6458a8e77157e93001e60..583b23cbb25d40c313be115b177ac54c8884226c 100644 (file)
@@ -208,5 +208,3 @@ def contributors_info(node):
 @register.inclusion_tag("node/reviser_info.html")\r
 def reviser_info(revision):\r
     return {'revision': revision}\r
-\r
-\r