Пример #1
0
def profile(request, user_name):
    user = get_object_or_404(User, username=user_name)
    solved = solvedProblems(user)
    return render_to_response(
        "basic_profile.html",
        {"required_user": user, "solved_problems": solved, "recent_activity": get_recent_activity()},
        context_instance=RequestContext(request),
    )
Пример #2
0
def profile(request, user_name):
    user = get_object_or_404(User, username=user_name)
    solved = solvedProblems(user)
    return render_to_response('basic_profile.html', {
        'required_user': user,
        'solved_problems': solved,
        'recent_activity': get_recent_activity()
    },
                              context_instance=RequestContext(request))
Пример #3
0
def home(request):
    if request.user.is_authenticated():
        submissions = Submission.objects.filter(user=request.user)[:10]
    else:
        submissions = None
    return render_to_response("index.html", {
        'recent_activity': get_recent_activity(),
        'submissions': submissions
    },
                              context_instance=RequestContext(request))
Пример #4
0
def editprofile(request, user_name):
    user = get_object_or_404(User, username=user_name)
    if user == request.user:
        if request.method == 'POST':
            user.first_name = request.POST['first_name']
            user.last_name = request.POST['last_name']
            user.email = request.POST['email']
            user.save()
            return redirect('/account/' + user.username)
        return render_to_response('editable_profile.html',
                                  {'recent_activity': get_recent_activity()},
                                  context_instance=RequestContext(request))

    else:
        return redirect('/account/' + user.username)
Пример #5
0
def editprofile(request, user_name):
    user = get_object_or_404(User, username=user_name)
    if user == request.user:
        if request.method == "POST":
            user.first_name = request.POST["first_name"]
            user.last_name = request.POST["last_name"]
            user.email = request.POST["email"]
            user.save()
            return redirect("/account/" + user.username)
        return render_to_response(
            "editable_profile.html",
            {"recent_activity": get_recent_activity()},
            context_instance=RequestContext(request),
        )

    else:
        return redirect("/account/" + user.username)