示例#1
0
文件: views.py 项目: alexef/wouso-1
def review(request, workshop):
    player = request.user.get_profile()
    workshop = get_object_or_404(Workshop, pk=workshop)

    assesment = Assesment.get_for_player_and_workshop(player, workshop)

    if not assesment:
        return do_error(request, _('Cannot review an workshop you did not participate to.'))

    assesments = player.assesments_review.filter(workshop=workshop)

    if request.method == 'POST':
        answer = get_object_or_404(Answer, pk=request.GET.get('a'))
        review = Review.objects.get_or_create(reviewer=player, answer=answer)[0]

        review.feedback = request.POST['feedback_%d' % answer.id]
        review.answer_grade = request.POST['grade_%d' % answer.id]
        review.save()

    return render_to_response('workshop/review.html',
                {'assesment': assesment,
                 'workshop': workshop,
                 'assesments': assesments},
                context_instance=RequestContext(request)
    )
示例#2
0
文件: views.py 项目: alexef/wouso-1
def index(request, extra_context=None):
    player = request.user.get_profile()
    assesment = Assesment.get_for_player_and_workshop(request.user.get_profile(), WorkshopGame.get_for_now())

    if not extra_context:
        extra_context = {}

    extra_context.update({'workshopgame': WorkshopGame, 'workshop': WorkshopGame.get_for_player_now(player),
                          'assesment': assesment})

    return render_to_response('workshop/index.html',
                extra_context,
                context_instance=RequestContext(request)
    )
示例#3
0
文件: views.py 项目: alexef/wouso-1
def results(request, workshop):
    player = request.user.get_profile()
    workshop = get_object_or_404(Workshop, pk=workshop)

    assesment = Assesment.get_for_player_and_workshop(player, workshop)

    if not assesment:
        return do_error(request, _('Cannot view results for an workshop you did not participate to.'))

    return render_to_response('workshop/results.html',
                {'assesment': assesment,
                 'workshop': workshop},
                context_instance=RequestContext(request)
    )