From 40e2851e2e2bf5e35063597b30ada01d06d2cc11 Mon Sep 17 00:00:00 2001 From: hernani Date: Thu, 23 Sep 2010 16:16:24 +0000 Subject: [PATCH] Some small tweaks. git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@597 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- forum/models/node.py | 9 ++++++++- forum/sitemap.py | 2 +- forum/skins/default/templates/question.html | 6 ++++-- forum/skins/default/templates/questions.html | 2 +- forum/urls.py | 4 ++-- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/forum/models/node.py b/forum/models/node.py index f62a8e0..36fbda9 100644 --- a/forum/models/node.py +++ b/forum/models/node.py @@ -247,7 +247,7 @@ class Node(BaseModel, NodeContent): @classmethod def _generate_cache_key(cls, key, group="node"): return super(Node, cls)._generate_cache_key(key, group) - + @classmethod def get_type(cls): return cls.__name__.lower() @@ -283,6 +283,13 @@ class Node(BaseModel, NodeContent): return nis + @property + def last_activity(self): + try: + return self.actions.order_by('-action_date')[0].action_date + except: + return self.last_seen + @property def state_list(self): return [s.state_type for s in self.states.all()] diff --git a/forum/sitemap.py b/forum/sitemap.py index 27528a0..d898124 100644 --- a/forum/sitemap.py +++ b/forum/sitemap.py @@ -2,7 +2,7 @@ from django.contrib.sitemaps import Sitemap from forum.models import Question from django.conf import settings -class QuestionsSitemap(Sitemap): +class OsqaSitemap(Sitemap): changefreq = 'daily' priority = 0.5 def items(self): diff --git a/forum/skins/default/templates/question.html b/forum/skins/default/templates/question.html index 1b5b8e3..03ef8ee 100644 --- a/forum/skins/default/templates/question.html +++ b/forum/skins/default/templates/question.html @@ -10,10 +10,12 @@ {% load cache %} {% block metadescription %}{{question.summary}}{% endblock %} {% block metakeywords %}{{question.tagname_meta_generator}}{% endblock %} -{% block title %}{% spaceless %}{{ question.headline }}{% endspaceless %}{% endblock %} -{% block forejs %} +{% block meta %} +{% endblock %} +{% block title %}{% spaceless %}{{ question.headline }}{% endspaceless %}{% endblock %} +{% block forejs %} {% if not question.nis.closed %} diff --git a/forum/skins/default/templates/questions.html b/forum/skins/default/templates/questions.html index d316670..3be2c97 100644 --- a/forum/skins/default/templates/questions.html +++ b/forum/skins/default/templates/questions.html @@ -7,7 +7,7 @@ {% block title %}{% spaceless %}{{ page_title }}{% endspaceless %}{% endblock %} -{% block forejs %} +{% block meta %} {% endblock %} diff --git a/forum/urls.py b/forum/urls.py index 3547fc2..d1715df 100644 --- a/forum/urls.py +++ b/forum/urls.py @@ -6,14 +6,14 @@ from django.conf.urls.defaults import * from django.conf import settings as djsettings from django.contrib import admin from forum import views as app -from forum.sitemap import QuestionsSitemap +from forum.sitemap import OsqaSitemap from django.utils.translation import ugettext as _ import logging admin.autodiscover() sitemaps = { - 'questions': QuestionsSitemap + 'questions': OsqaSitemap } APP_PATH = os.path.dirname(__file__) -- 2.39.5