Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(9)  |  Call(8)  |  Derive(0)  |  Import(1)

src/q/u/quanda-HEAD/views/voting.py   quanda(Download)
from quanda.models import Question, QuestionVote, Answer, AnswerVote
from quanda.utils import get_user_rep
from quanda.views import question_read
 
def question_adjust_vote(request, question_id, delta=0):
            msg = "You need to sign up and get at least %s rep to vote down a question" % vote_question_down_rep
        else: msg = None
        return question_read(request, question_id, context={'msg': msg})
 
    if delta == 1 and get_user_rep(request.user.username) < vote_question_up_rep:
        return question_read(
            request,
    elif delta == -1 and get_user_rep(request.user.username) < vote_question_down_rep:
        return question_read(
            request,
            question_id,
            context={'msg': "You need at least %s rep to vote down a question"\
    if request.user == question.author:
        return question_read(
            request,
            question_id,
            context={'msg': "You cannot vote on your own questions"}