• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python models.Repute类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中models.Repute的典型用法代码示例。如果您正苦于以下问题:Python Repute类的具体用法?Python Repute怎么用?Python Repute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Repute类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: onUpVoted

def onUpVoted(vote, post, user):
    vote.save()

    post.vote_up_count = int(post.vote_up_count) + 1
    post.score = int(post.score) + 1
    post.save()

    if not post.wiki:
        author = post.author
        if Repute.objects.get_reputation_by_upvoted_today(author) < int(REPUTATION_RULES["scope_per_day_by_upvotes"]):
            author.reputation = calculate_reputation(author.reputation, int(REPUTATION_RULES["gain_by_upvoted"]))
            author.save()

            question = post
            if ContentType.objects.get_for_model(post) == answer_type:
                question = post.question

            reputation = Repute(
                user=author,
                positive=int(REPUTATION_RULES["gain_by_upvoted"]),
                question=question,
                reputed_at=datetime.datetime.now(),
                reputation_type=1,
                reputation=author.reputation,
            )
            reputation.save()
开发者ID:hifans,项目名称:CNPROG,代码行数:26,代码来源:auth.py


示例2: onUpVotedCanceled

def onUpVotedCanceled(vote, post, user):
    vote.delete()

    post.vote_up_count = int(post.vote_up_count) - 1
    if post.vote_up_count < 0:
        post.vote_up_count = 0
    post.score = int(post.score) - 1
    post.save()

    if not post.wiki:
        author = post.author
        author.reputation = calculate_reputation(author.reputation, int(REPUTATION_RULES["lose_by_upvote_canceled"]))
        author.save()

        question = post
        if ContentType.objects.get_for_model(post) == answer_type:
            question = post.question

        reputation = Repute(
            user=author,
            negative=int(REPUTATION_RULES["lose_by_upvote_canceled"]),
            question=question,
            reputed_at=datetime.datetime.now(),
            reputation_type=-8,
            reputation=author.reputation,
        )
        reputation.save()
开发者ID:hifans,项目名称:CNPROG,代码行数:27,代码来源:auth.py


示例3: onUpVotedCanceled

def onUpVotedCanceled(vote, post, user, timestamp=None):
    if timestamp is None:
        timestamp = datetime.datetime.now()
    vote.delete()

    post.vote_up_count = int(post.vote_up_count) - 1
    if post.vote_up_count < 0:
        post.vote_up_count  = 0
    post.score = int(post.score) - 1
    post.save()

    if not post.wiki:
        author = post.author
        author.reputation = calculate_reputation(author.reputation,
                          int(REPUTATION_RULES['lose_by_upvote_canceled']))
        author.save()

        question = post
        if isinstance(post, Answer):
            question = post.question

        reputation = Repute(user=author,
                   negative=int(REPUTATION_RULES['lose_by_upvote_canceled']),
                   question=question,
                   reputed_at=timestamp,
                   reputation_type=-8,
                   reputation=author.reputation)
        reputation.save()
开发者ID:EzerchE,项目名称:askbot-devel,代码行数:28,代码来源:auth.py


示例4: onUpVoted

def onUpVoted(vote, post, user, timestamp=None):
    if timestamp is None:
        timestamp = datetime.datetime.now()
    vote.save()

    post.vote_up_count = int(post.vote_up_count) + 1
    post.score = int(post.score) + 1
    post.save()

    if not post.wiki:
        author = post.author
        todays_rep_gain = Repute.objects.get_reputation_by_upvoted_today(author)
        if todays_rep_gain <  int(REPUTATION_RULES['scope_per_day_by_upvotes']):
            author.reputation = calculate_reputation(author.reputation,
                              int(REPUTATION_RULES['gain_by_upvoted']))
            author.save()

            question = post
            if isinstance(post, Answer):
                question = post.question

            reputation = Repute(user=author,
                       positive=int(REPUTATION_RULES['gain_by_upvoted']),
                       question=question,
                       reputed_at=timestamp,
                       reputation_type=1,
                       reputation=author.reputation)
            reputation.save()
开发者ID:EzerchE,项目名称:askbot-devel,代码行数:28,代码来源:auth.py


示例5: onUpVotedCanceled

def onUpVotedCanceled(vote, post, user):
    vote.delete()

    post.decrement_vote_up_count()
    if post.vote_up_count < 0:
        post.vote_up_count  = 0
    post.score = int(post.score) - 1
    post.save()

    if not post.wiki:
        author = post.author
        author.reputation = calculate_reputation(author.reputation,
                          -int(settings.REP_LOST_BY_UPVOTE_CANCELED))
        author.save()

        question = post
        if post.__class__ == Answer:
            question = post.question

        reputation = Repute(user=author,
                   negative=-int(settings.REP_LOST_BY_UPVOTE_CANCELED),
                   question=question,
                   reputed_at=datetime.datetime.now(),
                   reputation_type=-8,
                   reputation=author.reputation)
        reputation.save()
开发者ID:cloudbring,项目名称:osqa,代码行数:26,代码来源:auth.py


示例6: onUpVoted

def onUpVoted(vote, post, user):
    vote.save()

    post.increment_vote_up_count()
    post.score = int(post.score) + 1
    post.save()

    if not post.wiki:
        author = post.author
        if Repute.objects.get_reputation_by_upvoted_today(author) <  int(settings.MAX_REP_BY_UPVOTE_DAY):
            author.reputation = calculate_reputation(author.reputation,
                              int(settings.REP_GAIN_BY_UPVOTED))
            author.save()

            question = post
            if post.__class__ == Answer:
                question = post.question

            reputation = Repute(user=author,
                       positive=int(settings.REP_GAIN_BY_UPVOTED),
                       question=question,
                       reputed_at=datetime.datetime.now(),
                       reputation_type=1,
                       reputation=author.reputation)
            reputation.save()
开发者ID:cloudbring,项目名称:osqa,代码行数:25,代码来源:auth.py


示例7: onFlaggedItem

def onFlaggedItem(item, post, user):

    item.save()
    post.offensive_flag_count = post.offensive_flag_count + 1
    post.save()

    post.author.reputation = calculate_reputation(post.author.reputation, int(REPUTATION_RULES["lose_by_flagged"]))
    post.author.save()

    question = post
    if ContentType.objects.get_for_model(post) == answer_type:
        question = post.question

    reputation = Repute(
        user=post.author,
        negative=int(REPUTATION_RULES["lose_by_flagged"]),
        question=question,
        reputed_at=datetime.datetime.now(),
        reputation_type=-4,
        reputation=post.author.reputation,
    )
    reputation.save()

    # todo: These should be updated to work on same revisions.
    if post.offensive_flag_count == VOTE_RULES["scope_flags_invisible_main_page"]:
        post.author.reputation = calculate_reputation(
            post.author.reputation, int(REPUTATION_RULES["lose_by_flagged_lastrevision_3_times"])
        )
        post.author.save()

        reputation = Repute(
            user=post.author,
            negative=int(REPUTATION_RULES["lose_by_flagged_lastrevision_3_times"]),
            question=question,
            reputed_at=datetime.datetime.now(),
            reputation_type=-6,
            reputation=post.author.reputation,
        )
        reputation.save()

    elif post.offensive_flag_count == VOTE_RULES["scope_flags_delete_post"]:
        post.author.reputation = calculate_reputation(
            post.author.reputation, int(REPUTATION_RULES["lose_by_flagged_lastrevision_5_times"])
        )
        post.author.save()

        reputation = Repute(
            user=post.author,
            negative=int(REPUTATION_RULES["lose_by_flagged_lastrevision_5_times"]),
            question=question,
            reputed_at=datetime.datetime.now(),
            reputation_type=-7,
            reputation=post.author.reputation,
        )
        reputation.save()

        post.deleted = True
        # post.deleted_at = datetime.datetime.now()
        # post.deleted_by = Admin
        post.save()
开发者ID:badri,项目名称:xwordclub,代码行数:60,代码来源:auth.py


示例8: onFlaggedItem

def onFlaggedItem(item, post, user, timestamp=None):
    if timestamp is None:
        timestamp = datetime.datetime.now()

    item.save()
    post.offensive_flag_count = post.offensive_flag_count + 1
    post.save()

    post.author.reputation = calculate_reputation(post.author.reputation,
                           int(REPUTATION_RULES['lose_by_flagged']))
    post.author.save()

    question = post
    if isinstance(post, Answer):
        question = post.question

    reputation = Repute(user=post.author,
               negative=int(REPUTATION_RULES['lose_by_flagged']),
               question=question, reputed_at=timestamp,
               reputation_type=-4,
               reputation=post.author.reputation)
    reputation.save()

    #todo: These should be updated to work on same revisions.
    if post.offensive_flag_count ==  VOTE_RULES['scope_flags_invisible_main_page'] :
        post.author.reputation = calculate_reputation(post.author.reputation,
                               int(REPUTATION_RULES['lose_by_flagged_lastrevision_3_times']))
        post.author.save()

        reputation = Repute(user=post.author,
                   negative=int(REPUTATION_RULES['lose_by_flagged_lastrevision_3_times']),
                   question=question,
                   reputed_at=timestamp,
                   reputation_type=-6,
                   reputation=post.author.reputation)
        reputation.save()

    elif post.offensive_flag_count == VOTE_RULES['scope_flags_delete_post']:
        post.author.reputation = calculate_reputation(post.author.reputation,
                               int(REPUTATION_RULES['lose_by_flagged_lastrevision_5_times']))
        post.author.save()

        reputation = Repute(user=post.author,
                   negative=int(REPUTATION_RULES['lose_by_flagged_lastrevision_5_times']),
                   question=question,
                   reputed_at=timestamp,
                   reputation_type=-7,
                   reputation=post.author.reputation)
        reputation.save()

        post.deleted = True
        #post.deleted_at = timestamp
        #post.deleted_by = Admin
        post.save()
        mark_offensive.send(
            sender=post.__class__, 
            instance=post, 
            mark_by=user
        )
开发者ID:EzerchE,项目名称:askbot-devel,代码行数:59,代码来源:auth.py


示例9: onFlaggedItem

def onFlaggedItem(item, post, user):

    item.save()
    post.offensive_flag_count = post.offensive_flag_count + 1
    post.save()

    post.author.reputation = calculate_reputation(post.author.reputation,
                           -int(settings.REP_LOST_BY_FLAGGED))
    post.author.save()

    question = post
    if post.__class__ == Answer:
        question = post.question

    reputation = Repute(user=post.author,
               negative=-int(settings.REP_LOST_BY_FLAGGED),
               question=question, reputed_at=datetime.datetime.now(),
               reputation_type=-4,
               reputation=post.author.reputation)
    reputation.save()

    #todo: These should be updated to work on same revisions.
    if post.offensive_flag_count == settings.FLAG_COUNT_TO_HIDE_POST :
        post.author.reputation = calculate_reputation(post.author.reputation,
                               -int(settings.REP_LOST_BY_FLAGGED_3_TIMES))
        post.author.save()

        reputation = Repute(user=post.author,
                   negative=-int(settings.REP_LOST_BY_FLAGGED_3_TIMES),
                   question=question,
                   reputed_at=datetime.datetime.now(),
                   reputation_type=-6,
                   reputation=post.author.reputation)
        reputation.save()

    elif post.offensive_flag_count == settings.FLAG_COUNT_TO_DELETE_POST:
        post.author.reputation = calculate_reputation(post.author.reputation,
                               -int(settings.REP_LOST_BY_FLAGGED_5_TIMES))
        post.author.save()

        reputation = Repute(user=post.author,
                   negative=-int(settings.REP_LOST_BY_FLAGGED_5_TIMES),
                   question=question,
                   reputed_at=datetime.datetime.now(),
                   reputation_type=-7,
                   reputation=post.author.reputation)
        reputation.save()

        post.deleted = True
        #post.deleted_at = datetime.datetime.now()
        #post.deleted_by = Admin
        post.save()
开发者ID:cloudbring,项目名称:osqa,代码行数:52,代码来源:auth.py


示例10: onAnswerAccept

def onAnswerAccept(answer, user):
    answer.accepted = True
    answer.accepted_at = datetime.datetime.now()
    answer.question.answer_accepted = True
    answer.save()
    answer.question.save()

    answer.author.reputation = calculate_reputation(answer.author.reputation,
                             int(settings.REP_GAIN_BY_ACCEPTED))
    answer.author.save()
    reputation = Repute(user=answer.author,
               positive=int(settings.REP_GAIN_BY_ACCEPTED),
               question=answer.question,
               reputed_at=datetime.datetime.now(),
               reputation_type=2,
               reputation=answer.author.reputation)
    reputation.save()

    user.reputation = calculate_reputation(user.reputation,
                    int(settings.REP_GAIN_BY_ACCEPTING))
    user.save()
    reputation = Repute(user=user,
               positive=int(settings.REP_GAIN_BY_ACCEPTING),
               question=answer.question,
               reputed_at=datetime.datetime.now(),
               reputation_type=3,
               reputation=user.reputation)
    reputation.save()
开发者ID:cloudbring,项目名称:osqa,代码行数:28,代码来源:auth.py


示例11: onAnswerAcceptCanceled

def onAnswerAcceptCanceled(answer, user):
    answer.accepted = False
    answer.accepted_at = None
    answer.question.answer_accepted = False
    answer.save()
    answer.question.save()

    answer.author.reputation = calculate_reputation(answer.author.reputation,
                             -int(settings.REP_GAIN_BY_ACCEPTED_CANCELED))
    answer.author.save()
    reputation = Repute(user=answer.author,
               negative=-int(settings.REP_GAIN_BY_ACCEPTED_CANCELED),
               question=answer.question,
               reputed_at=datetime.datetime.now(),
               reputation_type=-2,
               reputation=answer.author.reputation)
    reputation.save()

    user.reputation = calculate_reputation(user.reputation,
                    -int(settings.REP_LOST_BY_CANCELING_ACCEPTED))
    user.save()
    reputation = Repute(user=user,
               negative=-int(settings.REP_LOST_BY_CANCELING_ACCEPTED),
               question=answer.question,
               reputed_at=datetime.datetime.now(),
               reputation_type=-1,
               reputation=user.reputation)
    reputation.save()
开发者ID:cloudbring,项目名称:osqa,代码行数:28,代码来源:auth.py


示例12: onAnswerAccept

def onAnswerAccept(answer, user):
    answer.accepted = True
    answer.accepted_at = datetime.datetime.now()
    answer.question.answer_accepted = True
    answer.save()
    answer.question.save()

    answer.author.reputation = calculate_reputation(
        answer.author.reputation, int(REPUTATION_RULES["gain_by_answer_accepted"])
    )
    answer.author.save()
    reputation = Repute(
        user=answer.author,
        positive=int(REPUTATION_RULES["gain_by_answer_accepted"]),
        question=answer.question,
        reputed_at=datetime.datetime.now(),
        reputation_type=2,
        reputation=answer.author.reputation,
    )
    reputation.save()

    user.reputation = calculate_reputation(user.reputation, int(REPUTATION_RULES["gain_by_accepting_answer"]))
    user.save()
    reputation = Repute(
        user=user,
        positive=int(REPUTATION_RULES["gain_by_accepting_answer"]),
        question=answer.question,
        reputed_at=datetime.datetime.now(),
        reputation_type=3,
        reputation=user.reputation,
    )
    reputation.save()
开发者ID:badri,项目名称:xwordclub,代码行数:32,代码来源:auth.py


示例13: onAnswerAcceptCanceled

def onAnswerAcceptCanceled(answer, user, timestamp=None):
    if timestamp is None:
        timestamp = datetime.datetime.now()
    answer.accepted = False
    answer.accepted_at = None
    answer.question.answer_accepted = False
    answer.save()
    answer.question.save()

    answer.author.reputation = calculate_reputation(answer.author.reputation,
                             int(REPUTATION_RULES['lose_by_accepted_answer_cancled']))
    answer.author.save()
    reputation = Repute(user=answer.author,
               negative=int(REPUTATION_RULES['lose_by_accepted_answer_cancled']),
               question=answer.question,
               reputed_at=timestamp,
               reputation_type=-2,
               reputation=answer.author.reputation)
    reputation.save()

    user.reputation = calculate_reputation(user.reputation,
                    int(REPUTATION_RULES['lose_by_canceling_accepted_answer']))
    user.save()
    reputation = Repute(user=user,
               negative=int(REPUTATION_RULES['lose_by_canceling_accepted_answer']),
               question=answer.question,
               reputed_at=timestamp,
               reputation_type=-1,
               reputation=user.reputation)
    reputation.save()
开发者ID:EzerchE,项目名称:askbot-devel,代码行数:30,代码来源:auth.py


示例14: onAnswerAccept

def onAnswerAccept(answer, user, timestamp=None):
    if timestamp is None:
        timestamp = datetime.datetime.now()

    answer.accepted = True
    answer.accepted_at = timestamp
    answer.question.answer_accepted = True
    answer.save()
    answer.question.save()

    answer.author.reputation = calculate_reputation(answer.author.reputation,
                             int(REPUTATION_RULES['gain_by_answer_accepted']))
    answer.author.save()
    reputation = Repute(user=answer.author,
               positive=int(REPUTATION_RULES['gain_by_answer_accepted']),
               question=answer.question,
               reputed_at=timestamp,
               reputation_type=2,
               reputation=answer.author.reputation)
    reputation.save()

    user.reputation = calculate_reputation(user.reputation,
                    int(REPUTATION_RULES['gain_by_accepting_answer']))
    user.save()
    reputation = Repute(user=user,
               positive=int(REPUTATION_RULES['gain_by_accepting_answer']),
               question=answer.question,
               reputed_at=timestamp,
               reputation_type=3,
               reputation=user.reputation)
    reputation.save()
开发者ID:EzerchE,项目名称:askbot-devel,代码行数:31,代码来源:auth.py


示例15: onDownVotedCanceled

def onDownVotedCanceled(vote, post, user, timestamp=None):
    if timestamp is None:
        timestamp = datetime.datetime.now()
    vote.delete()

    post.vote_down_count = int(post.vote_down_count) - 1
    if post.vote_down_count < 0:
        post.vote_down_count  = 0
    post.score = post.score + 1
    post.save()

    if not post.wiki:
        author = post.author
        author.reputation = calculate_reputation(author.reputation,
                          int(REPUTATION_RULES['gain_by_downvote_canceled']))
        author.save()

        question = post
        if isinstance(post, Answer):
            question = post.question

        reputation = Repute(user=author,
                   positive=int(REPUTATION_RULES['gain_by_downvote_canceled']),
                   question=question,
                   reputed_at=timestamp,
                   reputation_type=4,
                   reputation=author.reputation)
        reputation.save()

        user.reputation = calculate_reputation(user.reputation,
                        int(REPUTATION_RULES['gain_by_canceling_downvote']))
        user.save()

        reputation = Repute(user=user,
                   positive=int(REPUTATION_RULES['gain_by_canceling_downvote']),
                   question=question,
                   reputed_at=timestamp,
                   reputation_type=5,
                   reputation=user.reputation)
        reputation.save()
开发者ID:EzerchE,项目名称:askbot-devel,代码行数:40,代码来源:auth.py


示例16: onDownVotedCanceled

def onDownVotedCanceled(vote, post, user):
    vote.delete()

    post.vote_down_count = int(post.vote_down_count) - 1
    if post.vote_down_count < 0:
        post.vote_down_count = 0
    post.score = post.score + 1
    post.save()

    if not post.wiki:
        author = post.author
        author.reputation = calculate_reputation(author.reputation, int(REPUTATION_RULES["gain_by_downvote_canceled"]))
        author.save()

        question = post
        if ContentType.objects.get_for_model(post) == answer_type:
            question = post.question

        reputation = Repute(
            user=author,
            positive=int(REPUTATION_RULES["gain_by_downvote_canceled"]),
            question=question,
            reputed_at=datetime.datetime.now(),
            reputation_type=4,
            reputation=author.reputation,
        )
        reputation.save()

        user.reputation = calculate_reputation(user.reputation, int(REPUTATION_RULES["gain_by_canceling_downvote"]))
        user.save()

        reputation = Repute(
            user=user,
            positive=int(REPUTATION_RULES["gain_by_canceling_downvote"]),
            question=question,
            reputed_at=datetime.datetime.now(),
            reputation_type=5,
            reputation=user.reputation,
        )
        reputation.save()
开发者ID:badri,项目名称:xwordclub,代码行数:40,代码来源:auth.py


示例17: onDownVoted

def onDownVoted(vote, post, user, timestamp=None):
    if timestamp is None:
        timestamp = datetime.datetime.now()
    vote.save()

    post.vote_down_count = int(post.vote_down_count) + 1
    post.score = int(post.score) - 1
    post.save()

    if not post.wiki:
        author = post.author
        author.reputation = calculate_reputation(author.reputation,
                          int(REPUTATION_RULES['lose_by_downvoted']))
        author.save()

        question = post
        if isinstance(post, Answer):
            question = post.question

        reputation = Repute(user=author,
                   negative=int(REPUTATION_RULES['lose_by_downvoted']),
                   question=question,
                   reputed_at=timestamp,
                   reputation_type=-3,
                   reputation=author.reputation)
        reputation.save()

        user.reputation = calculate_reputation(user.reputation,
                        int(REPUTATION_RULES['lose_by_downvoting']))
        user.save()

        reputation = Repute(user=user,
                   negative=int(REPUTATION_RULES['lose_by_downvoting']),
                   question=question,
                   reputed_at=timestamp,
                   reputation_type=-5,
                   reputation=user.reputation)
        reputation.save()
开发者ID:EzerchE,项目名称:askbot-devel,代码行数:38,代码来源:auth.py


示例18: onDownVotedCanceled

def onDownVotedCanceled(vote, post, user):
    vote.delete()

    post.vote_down_count = int(post.vote_down_count) - 1
    if post.vote_down_count < 0:
        post.vote_down_count  = 0
    post.score = post.score + 1
    post.save()

    if not post.wiki:
        author = post.author
        author.reputation = calculate_reputation(author.reputation,
                          int(settings.REP_GAIN_BY_DOWNVOTE_CANCELED))
        author.save()

        question = post
        if post.__class__ == Answer:
            question = post.question

        reputation = Repute(user=author,
                   positive=int(settings.REP_GAIN_BY_DOWNVOTE_CANCELED),
                   question=question,
                   reputed_at=datetime.datetime.now(),
                   reputation_type=4,
                   reputation=author.reputation)
        reputation.save()

        user.reputation = calculate_reputation(user.reputation,
                        int(settings.REP_GAIN_BY_CANCELING_DOWNVOTE))
        user.save()

        reputation = Repute(user=user,
                   positive=int(settings.REP_GAIN_BY_CANCELING_DOWNVOTE),
                   question=question,
                   reputed_at=datetime.datetime.now(),
                   reputation_type=5,
                   reputation=user.reputation)
        reputation.save()
开发者ID:cloudbring,项目名称:osqa,代码行数:38,代码来源:auth.py


示例19: onDownVoted

def onDownVoted(vote, post, user):
    vote.save()

    post.vote_down_count = int(post.vote_down_count) + 1
    post.score = int(post.score) - 1
    post.save()

    if not post.wiki:
        author = post.author
        author.reputation = calculate_reputation(author.reputation, int(REPUTATION_RULES["lose_by_downvoted"]))
        author.save()

        question = post
        if ContentType.objects.get_for_model(post) == answer_type:
            question = post.question

        reputation = Repute(
            user=author,
            negative=int(REPUTATION_RULES["lose_by_downvoted"]),
            question=question,
            reputed_at=datetime.datetime.now(),
            reputation_type=-3,
            reputation=author.reputation,
        )
        reputation.save()

        user.reputation = calculate_reputation(user.reputation, int(REPUTATION_RULES["lose_by_downvoting"]))
        user.save()

        reputation = Repute(
            user=user,
            negative=int(REPUTATION_RULES["lose_by_downvoting"]),
            question=question,
            reputed_at=datetime.datetime.now(),
            reputation_type=-5,
            reputation=user.reputation,
        )
        reputation.save()
开发者ID:badri,项目名称:xwordclub,代码行数:38,代码来源:auth.py


示例20: onDownVoted

def onDownVoted(vote, post, user):
    vote.save()

    post.vote_down_count = int(post.vote_down_count) + 1
    post.score = int(post.score) - 1
    post.save()

    if not post.wiki:
        author = post.author
        author.reputation = calculate_reputation(author.reputation,
                          -int(settings.REP_LOST_BY_DOWNVOTED))
        author.save()

        question = post
        if post.__class__ == Answer:
            question = post.question

        reputation = Repute(user=author,
                   negative=-int(settings.REP_LOST_BY_DOWNVOTED),
                   question=question,
                   reputed_at=datetime.datetime.now(),
                   reputation_type=-3,
                   reputation=author.reputation)
        reputation.save()

        user.reputation = calculate_reputation(user.reputation,
                        -int(settings.REP_LOST_BY_DOWNVOTING))
        user.save()

        reputation = Repute(user=user,
                   negative=-int(settings.REP_LOST_BY_DOWNVOTING),
                   question=question,
                   reputed_at=datetime.datetime.now(),
                   reputation_type=-5,
                   reputation=user.reputation)
        reputation.save()
开发者ID:cloudbring,项目名称:osqa,代码行数:36,代码来源:auth.py



注:本文中的models.Repute类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python models.Request类代码示例发布时间:2022-05-27
下一篇:
Python models.Report类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap