Пример #1
0
def show_submission(request, slug, submission_id):
    submission = get_object_or_404(Submission, id=submission_id,
        badge__slug=slug)
    badge = submission.badge
    assessments = Assessment.objects.filter(submission=submission_id,
        ready=True)
    avg_rating = Assessment.compute_average_rating(assessments)
    can_assess = True
    if request.user.is_authenticated():
        user = request.user.get_profile()
        has_assessed = Assessment.objects.filter(assessor=user,
            submission=submission)
        if has_assessed or user == submission.author:
            can_assess = False

    context = {
        'badge': badge,
        'submission': submission,
        'assessments': assessments,
        'avg_rating': avg_rating,
        'can_assess': can_assess,
        }

    return render_to_response('badges/submission_show.html', context,
                              context_instance=RequestContext(request))
Пример #2
0
def show_submission(request, slug, submission_id):
    submission = get_object_or_404(Submission,
                                   id=submission_id,
                                   badge__slug=slug)
    badge = submission.badge
    assessments = Assessment.objects.filter(submission=submission_id,
                                            ready=True)
    avg_rating = Assessment.compute_average_rating(assessments)
    can_assess = True
    if request.user.is_authenticated():
        user = request.user.get_profile()
        has_assessed = Assessment.objects.filter(assessor=user,
                                                 submission=submission)
        if has_assessed or user == submission.author:
            can_assess = False

    context = {
        'badge': badge,
        'submission': submission,
        'assessments': assessments,
        'avg_rating': avg_rating,
        'can_assess': can_assess,
    }

    return render_to_response('badges/submission_show.html',
                              context,
                              context_instance=RequestContext(request))
Пример #3
0
def show_submission(request, slug, submission_id):
    submission = get_object_or_404(Submission, id=submission_id,
        badge__slug=slug)
    badge = submission.badge
    assessments = Assessment.objects.filter(submission=submission,
        ready=True)
    avg_rating = Assessment.compute_average_rating(assessments)
    can_review_submission = badge.can_review_submission(submission, request.user)

    context = {
        'badge': badge,
        'submission': submission,
        'assessments': assessments,
        'avg_rating': avg_rating,
        'can_review_submission': can_review_submission,
        }

    return render_to_response('badges/submission_show.html', context,
                              context_instance=RequestContext(request))
Пример #4
0
def show_submission(request, slug, submission_id):
    submission = get_object_or_404(Submission,
                                   id=submission_id,
                                   badge__slug=slug)
    badge = submission.badge
    assessments = Assessment.objects.filter(submission=submission, ready=True)
    avg_rating = Assessment.compute_average_rating(assessments)
    can_review_submission = badge.can_review_submission(
        submission, request.user)

    context = {
        'badge': badge,
        'submission': submission,
        'assessments': assessments,
        'avg_rating': avg_rating,
        'can_review_submission': can_review_submission,
    }

    return render_to_response('badges/submission_show.html',
                              context,
                              context_instance=RequestContext(request))