예제 #1
0
def email(request, template_name="lfs/customer/email.html"):
    """Saves the email address from the data form.
    """
    if request.method == "POST":
        email_form = EmailForm(initial={"email": request.user.email}, data=request.POST)
        if email_form.is_valid():
            request.user.username = email_form.cleaned_data.get("email")[:30]
            request.user.email = email_form.cleaned_data.get("email")
            request.user.save()
            return lfs.core.utils.set_message_cookie(reverse("lfs_my_email"), msg=_(u"Your e-mail has been changed."))
    else:
        email_form = EmailForm(initial={"email": request.user.email})

    return render_to_response(template_name, RequestContext(request, {"email_form": email_form, "current": "email"}))
예제 #2
0
파일: views.py 프로젝트: potar/lfs
def email(request, template_name="lfs/customer/email.html"):
    """Saves the email address from the data form.
    """
    if request.method == "POST":
        email_form = EmailForm(initial={"email": request.user.email},
                               data=request.POST)
        if email_form.is_valid():
            request.user.email = email_form.cleaned_data.get("email")
            request.user.save()
            return HttpResponseRedirect(reverse("lfs_my_email"))
    else:
        email_form = EmailForm(initial={"email": request.user.email})

    return render_to_response(
        template_name, RequestContext(request, {"email_form": email_form}))
예제 #3
0
def email(request, template_name="lfs/customer/email.html"):
    """Saves the email address from the data form.
    """
    if request.method == "POST":
        email_form = EmailForm(initial={"email": request.user.email}, data=request.POST)
        if email_form.is_valid():
            request.user.email = email_form.cleaned_data.get("email")
            request.user.save()
            return HttpResponseRedirect(reverse("lfs_my_email"))
    else:
        email_form = EmailForm(initial={"email": request.user.email})

    return render_to_response(template_name, RequestContext(request, {
        "email_form": email_form
    }))
예제 #4
0
def email(request, template_name="lfs/customer/email.html"):
    """Saves the email address from the data form.
    """
    if request.method == "POST":
        email_form = EmailForm(initial={"email": request.user.email}, data=request.POST)
        if email_form.is_valid():
            request.user.username = email_form.cleaned_data.get("email")[:30]
            request.user.email = email_form.cleaned_data.get("email")
            request.user.save()
            return lfs.core.utils.set_message_cookie(reverse("lfs_my_email"),
                                                     msg=_(u"Your e-mail has been changed."))
    else:
        email_form = EmailForm(initial={"email": request.user.email})

    return render(request, template_name, {
        "email_form": email_form,
        "current": "email"
    })