summaryrefslogtreecommitdiffstats
path: root/askbot/models
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2013-03-27 23:41:46 -0400
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2013-03-27 23:41:46 -0400
commit85db009cc8f28f98c277c3631f169b5d648a1155 (patch)
tree3225549f3a128bf4671079aa09d047fa02de70c4 /askbot/models
parenta4a2fcf214813d5c79908609b335cab3d2599a62 (diff)
parent86c38acf1038c23f0f4bd83a980cf5369834eaf5 (diff)
downloadaskbot-85db009cc8f28f98c277c3631f169b5d648a1155.tar.gz
askbot-85db009cc8f28f98c277c3631f169b5d648a1155.tar.bz2
askbot-85db009cc8f28f98c277c3631f169b5d648a1155.zip
merged the master branch
Diffstat (limited to 'askbot/models')
-rw-r--r--askbot/models/question.py20
-rw-r--r--askbot/models/signals.py10
2 files changed, 26 insertions, 4 deletions
diff --git a/askbot/models/question.py b/askbot/models/question.py
index 51a7c24b..455b0845 100644
--- a/askbot/models/question.py
+++ b/askbot/models/question.py
@@ -336,12 +336,24 @@ class ThreadManager(BaseQuerySetManager):
else:
raise Exception('UNANSWERED_QUESTION_MEANING setting is wrong')
- elif search_state.scope == 'favorite':
- favorite_filter = models.Q(favorited_by=request_user)
+ elif search_state.scope == 'followed':
+ 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:
diff --git a/askbot/models/signals.py b/askbot/models/signals.py
index d538de76..f5187876 100644
--- a/askbot/models/signals.py
+++ b/askbot/models/signals.py
@@ -25,6 +25,16 @@ user_registered = django.dispatch.Signal(providing_args=['user',])
#todo: move this to authentication app
user_logged_in = django.dispatch.Signal(providing_args=['session'])
+new_answer_posted = django.dispatch.Signal(
+ providing_args=['answer', 'user', 'form_data']
+)
+answer_edited = django.dispatch.Signal(
+ providing_args=['answer', 'user', 'form_data']
+)
+answer_before_editing = django.dispatch.Signal(
+ providing_args=['answer', 'user', 'form']
+)
+
post_updated = django.dispatch.Signal(
providing_args=[
'post',