Exemple #1
0
def mypage_edit_profile(request):
    user_pk = request.user.pk
    try:
        current_profile = MyUserProfile.objects.get(myuser=user_pk)
    except MyUserProfile.DoesNotExist:
        messages.add_message(request, messages.ERROR,
                             'プロファイルが正しく設定出来ていません。お手数ですが運営者にお問い合わせください。')
        return redirect('mypage_home')

    set_next_url(request)
    if request.method == 'POST':
        form = MyUserProfileEditForm(request.POST, instance=current_profile)
        if form.is_valid():
            form.save()
            messages.add_message(request, messages.SUCCESS, 'ユーザー情報の変更に成功しました')
            if get_next_url(request):
                return redirect(get_next_url(request))
            else:
                return redirect('mypage_home')
    else:
        form = MyUserProfileEditForm(instance=current_profile)

    return render_to_response('accounts/edit_profile.html', {
        'form': form,
    },
                              context_instance=RequestContext(request))
Exemple #2
0
def mypage_edit_profile(request):
    user_pk = request.user.pk
    try:
        current_profile = MyUserProfile.objects.get(myuser=user_pk)
    except MyUserProfile.DoesNotExist:
        messages.add_message(request, messages.ERROR, 'プロファイルが正しく設定出来ていません。お手数ですが運営者にお問い合わせください。')
        return redirect('mypage_home')

    set_next_url(request)
    if request.method == 'POST':
        form = MyUserProfileEditForm(request.POST, instance=current_profile)
        if form.is_valid():
            form.save()
            messages.add_message(request, messages.SUCCESS, 'ユーザー情報の変更に成功しました')
            if get_next_url(request):
                return redirect(get_next_url(request))
            else:
                return redirect('mypage_home')
    else:
        form = MyUserProfileEditForm(instance=current_profile)

    return render_to_response(
        'accounts/edit_profile.html',
        {
            'form': form,
        },
        context_instance=RequestContext(request)
    )
Exemple #3
0
def activate_complete(request):
    next = get_next_url(request)
    if next:
        return redirect(next)
    return render_to_response('registration/activation_complete.html',
                              context_instance=RequestContext(request))
Exemple #4
0
def activate_complete(request):
    next = get_next_url(request)
    if next:
        return redirect(next)
    return render_to_response("registration/activation_complete.html", context_instance=RequestContext(request))