def profile_edit(request):
    params = _common_params(request)
    params['cancel_url'] = reverse(profile)

    if request.user.is_authenticated():
        hackerprofile = request.user.hackerprofile
        if request.method == 'POST':
            form = EditHackerProfileForm(request.POST, instance=hackerprofile)
            if form.is_valid():
                form.save()
                return redirect(profile)
        else:
            form = EditHackerProfileForm(instance=hackerprofile)
    else:
        form = EditHackerProfileForm()

    params['form'] = form

    template_path = 'oneliners/pages/profile_edit.html'
    return render(request, template_path, params)
Beispiel #2
0
def profile_edit(request):
    params = _common_params(request)
    params['cancel_url'] = reverse(profile)

    if request.user.is_authenticated():
        hackerprofile = request.user.hackerprofile
        if request.method == 'POST':
            form = EditHackerProfileForm(request.POST, instance=hackerprofile)
            if form.is_valid():
                form.save()
                return redirect(profile)
        else:
            form = EditHackerProfileForm(instance=hackerprofile)
    else:
        form = EditHackerProfileForm()

    params['form'] = form

    return ('oneliners/pages/profile_edit.html', params)
Beispiel #3
0
def profile_edit(request):
    params = _common_params(request)
    params["cancel_url"] = reverse(profile)

    if request.user.is_authenticated():
        hackerprofile = request.user.hackerprofile
        if request.method == "POST":
            form = EditHackerProfileForm(request.POST, instance=hackerprofile)
            if form.is_valid():
                form.save()
                return redirect(profile)
        else:
            form = EditHackerProfileForm(instance=hackerprofile)
    else:
        form = EditHackerProfileForm()

    params["form"] = form

    template_path = "oneliners/pages/profile_edit.html"
    return render_to_response(template_path, params, context_instance=RequestContext(request))
Beispiel #4
0
def profile_edit(request):
    params = _common_params(request)
    initial = _common_initial(request)
    params['next_url'] = initial['next_url']

    if request.user.is_authenticated():
        hackerprofile = request.user.hackerprofile
        if request.method == 'POST':
            form = EditHackerProfileForm(request.POST, instance=hackerprofile)
            if form.is_valid():
                form.save()
                return redirect(profile)
            else:
                params['next_url'] = request.POST.get('next_url')
        else:
            form = EditHackerProfileForm(instance=hackerprofile, initial=initial)
    else:
        form = EditHackerProfileForm(initial=initial)

    params['form'] = form

    return render_to_response('main/pages/profile_edit.html', params, context_instance=RequestContext(request))