diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2012-10-16 02:19:49 -0300 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2012-10-16 02:19:49 -0300 |
commit | d91cae28c867557bc660b6a8898229e52c5487d5 (patch) | |
tree | 8e4281cccd404f74cda1ccdcca6a18b04fa8db38 /askbot/views/users.py | |
parent | 10aa8cb45fa01cd7d809cca70895092bc9a485ee (diff) | |
parent | 8206b2955fc0953afe9f7f7b6834a9e132f5d497 (diff) | |
download | askbot-d91cae28c867557bc660b6a8898229e52c5487d5.tar.gz askbot-d91cae28c867557bc660b6a8898229e52c5487d5.tar.bz2 askbot-d91cae28c867557bc660b6a8898229e52c5487d5.zip |
merged the master branch and fixed issues when you visit a thread by url and then try to create a new thread or visit other threads lists
Diffstat (limited to 'askbot/views/users.py')
-rw-r--r-- | askbot/views/users.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/askbot/views/users.py b/askbot/views/users.py index 7e1859bf..1e1d1dc8 100644 --- a/askbot/views/users.py +++ b/askbot/views/users.py @@ -371,9 +371,15 @@ def user_stats(request, user, context): # # Questions # - questions = user.posts.get_questions().filter(**question_filter).\ - order_by('-score', '-thread__last_activity_at').\ - select_related('thread', 'thread__last_activity_by')[:100] + questions = user.posts.get_questions( + user=request.user + ).filter( + **question_filter + ).order_by( + '-points', '-thread__last_activity_at' + ).select_related( + 'thread', 'thread__last_activity_by' + )[:100] #added this if to avoid another query if questions is less than 100 if len(questions) < 100: @@ -393,7 +399,7 @@ def user_stats(request, user, context): ).select_related( 'thread' ).order_by( - '-score', '-added_at' + '-points', '-added_at' )[:100] top_answer_count = len(top_answers) @@ -726,7 +732,7 @@ def user_responses(request, user, context): and "flags" - moderation items for mods only """ - #0) temporary, till urls are fixed: update context + #0) temporary, till urls are fixed: update context # to contain response counts for all sub-sections context.update(view_context.get_for_inbox(request.user)) @@ -918,7 +924,7 @@ def user_favorites(request, user, context): favorite_threads = user.user_favorite_questions.values_list('thread', flat=True) questions = models.Post.objects.filter(post_type='question', thread__in=favorite_threads)\ .select_related('thread', 'thread__last_activity_by')\ - .order_by('-score', '-thread__last_activity_at')[:const.USER_VIEW_DATA_SIZE] + .order_by('-points', '-thread__last_activity_at')[:const.USER_VIEW_DATA_SIZE] data = { 'active_tab':'users', |