Exemple #1
0
def profile_edit(request):
    user = request.user
    form = UserForm(request.POST or None, request.FILES or None, instance = UserProfile.objects.get_or_create(user=user)[0])

    if form.is_valid():
        form.save()

        messages.add_message(request, messages.INFO, _("Successfully updated your profile."))
        return redirect('evap.contributor.views.index')
    else:
        return render_to_response("contributor_profile.html", dict(form=form), context_instance=RequestContext(request))
Exemple #2
0
def profile_edit(request):
    user = request.user
    form = UserForm(request.POST or None, request.FILES or None, instance=user)

    if form.is_valid():
        form.save()

        messages.success(request, _("Successfully updated your profile."))
        return redirect('evap.contributor.views.index')
    else:
        return render(request, "contributor_profile.html", dict(form=form))