summaryrefslogtreecommitdiffstats
path: root/askbot/feed.py
diff options
context:
space:
mode:
authorDejan Noveski <dr.mote@gmail.com>2011-11-15 23:42:04 +0100
committerDejan Noveski <dr.mote@gmail.com>2011-11-15 23:42:04 +0100
commitff17439076efd7abff617ddc5b96f4ee8f7ee340 (patch)
treec1149c07ef2b483e22089b58562c449961f8fb0d /askbot/feed.py
parent54c40830e3f93760debb53dd5fc5853d75e06818 (diff)
downloadaskbot-ff17439076efd7abff617ddc5b96f4ee8f7ee340.tar.gz
askbot-ff17439076efd7abff617ddc5b96f4ee8f7ee340.tar.bz2
askbot-ff17439076efd7abff617ddc5b96f4ee8f7ee340.zip
Updated live search to switch feed url, added comments - better code, removed unused import, querystring building moved further up to be used in AJAX response
Diffstat (limited to 'askbot/feed.py')
-rw-r--r--askbot/feed.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/askbot/feed.py b/askbot/feed.py
index b71a3696..20932f1a 100644
--- a/askbot/feed.py
+++ b/askbot/feed.py
@@ -18,7 +18,6 @@ from django.utils.translation import ugettext as _
from django.core.exceptions import ObjectDoesNotExist
from askbot.models import Question, Answer, Comment
from askbot.conf import settings as askbot_settings
-from askbot.search.state_manager import SearchState
import itertools
class RssIndividualQuestionFeed(Feed):
@@ -138,15 +137,22 @@ class RssLastestQuestionsFeed(Feed):
def items(self, item):
"""get questions for the feed
"""
+ #initial filtering
qs = Question.objects.filter(deleted=False)
+
+ #get search string and tags from GET
query = self.request.GET.get("q", None)
tags = self.request.GET.getlist("tags")
if query:
+ #if there's a search string, use the
+ #question search method
qs = qs.get_by_text_query(query)
if tags:
- for tag in tags:
+ #if there are tags in GET, filter the
+ #questions additionally
+ for tag in tags:
qs = qs.filter(tags__name = tag)
return qs.order_by('-last_activity_at')