]> git.openstreetmap.org Git - osqa.git/commitdiff
Fixes a bug in the user profile.
authorhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Thu, 26 May 2011 15:51:37 +0000 (15:51 +0000)
committerhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Thu, 26 May 2011 15:51:37 +0000 (15:51 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1050 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/views/readers.py
forum/views/users.py

index 6ee2c24942372674490bcd18a86356633145e914..dccb05e520ea53a69e2fa695334db4ab2832436c 100644 (file)
@@ -160,7 +160,7 @@ def question_list(request, initial,
                   allowIgnoreTags=True,
                   feed_url=None,
                   paginator_context=None,
-                  feed_sort='-added_at'):
+                  feed_sort=('-added_at',)):
 
     questions = initial.filter_state(deleted=False)
 
@@ -171,7 +171,8 @@ def question_list(request, initial,
         page_title = _("Questions")
 
     if request.GET.get('type', None) == 'rss':
-        questions = questions.order_by(feed_sort)
+        if feed_sort:
+            questions = questions.order_by(*feed_sort)
         return RssQuestionFeed(request, questions, page_title, list_description)(request)
 
     keywords =  ""
@@ -218,6 +219,7 @@ def search(request):
 
 @decorators.render('questions.html')
 def question_search(request, keywords):
+    rank_feed = False
     can_rank, initial = Question.objects.search(keywords)
 
     if can_rank:
@@ -225,6 +227,7 @@ def question_search(request, keywords):
 
         if isinstance(can_rank, basestring):
             sort_order = can_rank
+            rank_feed = True
 
         paginator_context = QuestionListPaginatorContext()
         paginator_context.sort_methods[_('ranking')] = pagination.SimpleSort(_('relevance'), sort_order, _("most relevant questions"))
@@ -239,7 +242,7 @@ def question_search(request, keywords):
                          None,
                          _("questions matching '%(keywords)s'") % {'keywords': keywords},
                          paginator_context=paginator_context,
-                         feed_url=feed_url)
+                         feed_url=feed_url, feed_sort=rank_feed and (can_rank,) or '-added_at')
 
 
 @decorators.render('tags.html', 'tags', _('tags'), weight=100)
index 8441f96dd64fd1b169753d0007fcfa9127f29af2..0eeb122d29e8ff74d47762d4da60e6db16717e29 100644 (file)
@@ -315,7 +315,7 @@ def user_profile(request, user):
               Badge.objects.filter(awards__user=user).values('id').annotate(count=Count('cls')).order_by('-count')]\r
 \r
     return pagination.paginated(request, (\r
-    ('questions', QuestionListPaginatorContext('USER_QUESTION_LIST', _('questions'), 15)),\r
+    ('questions', QuestionListPaginatorContext('USER_QUESTION_LIST', _('questions'), default_pagesize=15)),\r
     ('answers', UserAnswersPaginatorContext())), {\r
     "view_user" : user,\r
     "questions" : questions,\r