Ejemplo n.º 1
0
 def handle(self, *args, **options):
     for user in User.objects.all():
         qm = QuestionMeta.objects.get(id=settings.AVATAR_QUESTIONMETA_ID)
         story = user.story_set.filter(question_meta=qm).first()
         if story:
             _set_avatar_to_answer(story)
             print "avatar fixed for %s" % story.owner
Ejemplo n.º 2
0
def _user_created_story_callback_task(story):
    _update_related_question_meta_of_story(story)
    _update_related_profile_of_story(story)

    # If story is answer of a question notify questioner
    if story.question:
        notify(ntype_slug='user_answered_my_question',
               sub=story.question.questionee,
               obj=story.question,
               recipient=story.question.questioner,
               ignored_recipients=[story.owner],
               url=story.get_absolute_url())

    # If questionmeta has followers. Notify them new answers.
    meta = story.question_meta
    for follow in QuestionFollow.objects.filter(
            status=QuestionFollow.FOLLOWING, target=meta):
        notify(ntype_slug='new_answer_to_following_question',
               sub=story,
               obj=meta,
               recipient=follow.follower,
               ignored_recipients=[story.owner],
               url=meta.get_absolute_url())

    # Set avatar for user if necessary.
    if settings.AVATAR_QUESTIONMETA_ID == story.question_meta_id:
        _set_avatar_to_answer(story)
Ejemplo n.º 3
0
def _user_created_story_callback_task(story):
    _update_related_question_meta_of_story(story)
    _update_related_profile_of_story(story)

    # If story is answer of a question notify questioner
    if story.question:
        notify(ntype_slug='user_answered_my_question',
               sub=story.question.questionee,
               obj=story.question, recipient=story.question.questioner,
               ignored_recipients=[story.owner],
               url=story.get_absolute_url())

    # If questionmeta has followers. Notify them new answers.
    meta = story.question_meta
    for follow in QuestionFollow.objects.filter(
            status=QuestionFollow.FOLLOWING, target=meta):
        notify(ntype_slug='new_answer_to_following_question',
               sub=story, obj=meta, recipient=follow.follower,
               ignored_recipients=[story.owner],
               url=meta.get_absolute_url())

    # Set avatar for user if necessary.
    if settings.AVATAR_QUESTIONMETA_ID == story.question_meta_id:
        _set_avatar_to_answer(story)