diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2013-03-26 01:27:42 -0400 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2013-03-26 01:28:49 -0400 |
commit | 056d1c9f0f9dbbbab395a3df79824c9ec7f9afe2 (patch) | |
tree | 3a285b9dae06f21c47e06ff4b580638d8c26f295 /askbot/models | |
parent | ca20e68ce4e7f9d3866adab1605add1b8a79fe6e (diff) | |
download | askbot-056d1c9f0f9dbbbab395a3df79824c9ec7f9afe2.tar.gz askbot-056d1c9f0f9dbbbab395a3df79824c9ec7f9afe2.tar.bz2 askbot-056d1c9f0f9dbbbab395a3df79824c9ec7f9afe2.zip |
created default filler for the "followed" scope when it is the only enabled scope and added custom js placeholder for the question page
Diffstat (limited to 'askbot/models')
-rw-r--r-- | askbot/models/question.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/askbot/models/question.py b/askbot/models/question.py index 5526d3a8..455b0845 100644 --- a/askbot/models/question.py +++ b/askbot/models/question.py @@ -337,11 +337,23 @@ class ThreadManager(BaseQuerySetManager): raise Exception('UNANSWERED_QUESTION_MEANING setting is wrong') elif search_state.scope == 'followed': - favorite_filter = models.Q(favorited_by=request_user) + followed_filter = models.Q(favorited_by=request_user) if 'followit' in django_settings.INSTALLED_APPS: followed_users = request_user.get_followed_users() - favorite_filter |= models.Q(posts__post_type__in=('question', 'answer'), posts__author__in=followed_users) - qs = qs.filter(favorite_filter) + followed_filter |= models.Q(posts__post_type__in=('question', 'answer'), posts__author__in=followed_users) + + #a special case: "personalized" main page only == + #if followed is the only available scope + #if total number (regardless of users selections) + #followed questions is < than a pagefull - we should mix in a list of + #random questions + if askbot_settings.ALL_SCOPE_ENABLED == askbot_settings.UNANSWERED_SCOPE_ENABLED == False: + followed_question_count = qs.filter(followed_filter).distinct().count() + if followed_question_count < 30: + #here we mix in anything + followed_filter |= models.Q(deleted=False) + + qs = qs.filter(followed_filter) #user contributed questions & answers if search_state.author: |