summaryrefslogtreecommitdiffstats
path: root/forum/managers.py
diff options
context:
space:
mode:
authorroot <root@u15356270.onlinehome-server.com>2009-11-13 20:18:31 -0500
committerroot <root@u15356270.onlinehome-server.com>2009-11-13 20:31:16 -0500
commit40b5c06085fe3d079094e8ef779a7b119586f9e8 (patch)
tree5a3edfb81cc137dbc877f75f9bde80e9720b3ba0 /forum/managers.py
parent2022b772a01f36fa74de002b5370dd70b6c051ba (diff)
downloadaskbot-40b5c06085fe3d079094e8ef779a7b119586f9e8.tar.gz
askbot-40b5c06085fe3d079094e8ef779a7b119586f9e8.tar.bz2
askbot-40b5c06085fe3d079094e8ef779a7b119586f9e8.zip
better comments, email subscriptions, corrected view counter, some ie7 issues, wiki optional with settings.WIKI_ON, site can be mounted on arbitrary url prefix, english language improvements, added feedback form, versioned css and js files to force browser cache reload when settings.RESOURCE_REVISION is incremented , other fixes
Diffstat (limited to 'forum/managers.py')
-rw-r--r--forum/managers.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/forum/managers.py b/forum/managers.py
index 6ae0ed99..795d382e 100644
--- a/forum/managers.py
+++ b/forum/managers.py
@@ -70,7 +70,7 @@ class QuestionManager(models.Manager):
# although we have imported all classes from models on top.
from forum.models import Answer
self.filter(id=question.id).update(
- answer_count=Answer.objects.get_answers_from_question(question).count())
+ answer_count=Answer.objects.get_answers_from_question(question).filter(deleted=False).count())
def update_view_count(self, question):
"""
@@ -93,11 +93,11 @@ class QuestionManager(models.Manager):
"""
#print datetime.datetime.now()
from forum.models import Question
- questions = list(Question.objects.filter(tagnames = question.tagnames).all())
+ questions = list(Question.objects.filter(tagnames = question.tagnames, deleted=False).all())
tags_list = question.tags.all()
for tag in tags_list:
- extend_questions = Question.objects.filter(tags__id = tag.id)[:50]
+ extend_questions = Question.objects.filter(tags__id = tag.id, deleted=False)[:50]
for item in extend_questions:
if item not in questions and len(questions) < 10:
questions.append(item)
@@ -110,10 +110,11 @@ class TagManager(models.Manager):
'UPDATE tag '
'SET used_count = ('
'SELECT COUNT(*) FROM question_tags '
- 'WHERE tag_id = tag.id'
+ 'INNER JOIN question ON question_id=question.id '
+ 'WHERE tag_id = tag.id AND question.deleted=0'
') '
'WHERE id IN (%s)')
-
+
def get_valid_tags(self, page_size):
from forum.models import Tag
tags = Tag.objects.all().filter(deleted=False).exclude(used_count=0).order_by("-id")[:page_size]