• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python accounts.get_profile_form函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mezzanine.accounts.get_profile_form函数的典型用法代码示例。如果您正苦于以下问题:Python get_profile_form函数的具体用法?Python get_profile_form怎么用?Python get_profile_form使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_profile_form函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: profile_update

def profile_update(request, template="accounts/account_profile_update.html"):
    """
    Profile update form.
    """
    profile_form = get_profile_form()
    form = profile_form(request.POST or None, request.FILES or None,
                        instance=request.user)
    if request.method == "POST" and form.is_valid():
        user = form.save()
        info(request, _("Profile updated"))
        try:

            customer = request.user.get_profile()
            customer_address = customer.address + ', ' + customer.zip_code
            loc = location_utils.getLocation(customer_address)
            correct_address = location_utils.getAddress(loc[0],loc[1])
            customer.location = loc
            customer.address = correct_address
            customer.save()

            request.session['location'] = (loc[0],loc[1])
            request.session['age'] = True
            request.session['address'] = correct_address
            request.session['map'] = True

            avail_store_ids, avail_store_names, avail_liquor_types, loc, store_locs = new_location_get_ids(request, loc)

            return redirect("profile", username=user.username)
        except NoReverseMatch:
            return redirect("profile_update")
    context = {"form": form, "title": _("Update Profile")}
    return render(request, template, context)
开发者ID:obsjames,项目名称:md-production-public,代码行数:32,代码来源:views.py


示例2: signup

def signup(request, template="accounts/account_signup.html",
           extra_context=None):
    """
    Signup form.
    """
    profile_form = get_profile_form()
    form = profile_form(request.POST or None, request.FILES or None)
    if request.method == "POST" and form.is_valid():
        new_user = form.save()
        if not new_user.is_active:
            if settings.ACCOUNTS_APPROVAL_REQUIRED:
                send_approve_mail(request, new_user)
                info(request, _("Thanks for signing up! You'll receive "
                                "an email when your account is activated."))
            else:
                send_verification_mail(request, new_user, "signup_verify")
                info(request, _("A verification email has been sent with "
                                "a link for activating your account."))
            return redirect(next_url(request) or "/")
        else:
            info(request, _("Successfully signed up"))
            auth_login(request, new_user)
            return login_redirect(request)
    context = {"form": form, "title": _("Sign up")}
    context.update(extra_context or {})
    return TemplateResponse(request, template, context)
开发者ID:Anlim,项目名称:mezzanine,代码行数:26,代码来源:views.py


示例3: signup

def signup(request, template="accounts/account_signup.html"):
    """
    Signup form.
    """
    profile_form = get_profile_form()
    form = profile_form(request.POST or None, request.FILES or None)
    if request.method == "POST" and form.is_valid():
        new_user = form.save()
        if not new_user.is_active:
            if settings.ACCOUNTS_APPROVAL_REQUIRED:
                send_approve_mail(request, new_user)
                info(request, _("Thanks for signing up! You'll receive "
                                "an email when your account is activated."))
            else:
                send_verification_mail(request, new_user, "signup_verify")
                info(request, _("A verification email has been sent with "
                                "a link for activating your account."))
            return redirect(request.GET.get("next", "/"))
        else:
            info(request, _("Successfully signed up"))
            auth_login(request, new_user)
            return login_redirect(request)
    else:
        log.debug('Form is not valid. Errors: %s' % form.errors)
    context = {"form": form, "title": _("Create an Account"), "submit_label": "Next Step"}
    return render(request, template, context)
开发者ID:orlenko,项目名称:sfpirg,代码行数:26,代码来源:views.py


示例4: signup_form

def signup_form(*args):
    """
    Returns the signup form:

    {% signup_form as form %}
    {{ form }}

    """
    return get_profile_form()()
开发者ID:11m09d,项目名称:weixin_market,代码行数:9,代码来源:accounts_tags.py


示例5: profile_form

def profile_form(user):
    """
    Returns the profile form for a user:

    {% if request.user.is_authenticated %}
    {% profile_form request.user as form %}
    {{ form }}
    {% endif %}

    """
    if isinstance(user, User):
        return get_profile_form()(instance=user)
    return ""
开发者ID:11m09d,项目名称:weixin_market,代码行数:13,代码来源:accounts_tags.py


示例6: profile_update

def profile_update(request, template="accounts/account_profile_update.html"):
    """
    Profile update form.
    """
    profile_form = get_profile_form()
    form = profile_form(request.POST or None, instance=request.user)
    if request.method == "POST" and form.is_valid():
        user = form.save()
        info(request, _("Profile updated"))
        try:
            return redirect("profile", username=user.username)
        except NoReverseMatch:
            return redirect("profile_update")
    context = {"form": form, "title": _("Update Profile")}
    return render(request, template, context)
开发者ID:aTnT,项目名称:mezzanine-dotcloud,代码行数:15,代码来源:views.py


示例7: signup

def signup(request, template="accounts/account_signup.html"):
    """
    Signup form.
    """
    profile_form = get_profile_form()
    form = profile_form(request.POST or None, request.FILES or None)
    if request.method == "POST" and form.is_valid():
        new_user = form.save()
        if not new_user.is_active:
            if settings.ACCOUNTS_APPROVAL_REQUIRED:
                send_approve_mail(request, new_user)
                info(request, _("Thanks for signing up! You'll receive "
                                "an email when your account is activated."))
            else:
                send_verification_mail(request, new_user, "signup_verify")
                info(request, _("A verification email has been sent with "
                                "a link for activating your account."))
#            return redirect(request.GET.get("next", "/"))
            return redirect(next_url(request) or "/")
        else:
            info(request, _("Successfully signed up"))
            auth_login(request, new_user)

            customer = request.user.get_profile()
            customer_address = customer.address + ', ' + customer.zip_code
            loc = location_utils.getLocation(customer_address)
            correct_address = location_utils.getAddress(loc[0],loc[1])
            customer.location = loc
            customer.address = correct_address
            customer.save()

            request.session['location'] = (loc[0],loc[1])
            request.session['age'] = True
            request.session['address'] = correct_address
            request.session['map'] = True

            avail_store_ids, avail_store_names, avail_liquor_types, loc, store_locs = new_location_get_ids(request, loc)

#            return login_redirect(request)
            if 'cart loaded' in request.session:
                return redirect('/shop/cart/')
            else:
                return redirect('/shop/')
    context = {"form": form, "title": _("Sign up")}
    return render(request, template, context)
开发者ID:obsjames,项目名称:md-production-public,代码行数:45,代码来源:views.py


示例8: signup

def signup(request, template="accounts/account_signup.html"):
    """
    Signup form.
    """
    profile_form = get_profile_form()
    form = profile_form(request.POST or None)
    if request.method == "POST" and form.is_valid():
        new_user = form.save()
        if not new_user.is_active:
            send_verification_mail(request, new_user, "signup_verify")
            info(request, _("A verification email has been sent with " "a link for activating your account."))
            return redirect(request.GET.get("next", "/"))
        else:
            info(request, _("Successfully signed up"))
            auth_login(request, new_user)
            return login_redirect(request)
    context = {"form": form, "title": _("Signup")}
    return render(request, template, context)
开发者ID:niotech,项目名称:mezzanine,代码行数:18,代码来源:views.py


示例9: profile_update

def profile_update(request, template="accounts/account_profile_update.html"):
    """
    Profile update form.
    """
    profile_form = get_profile_form()
    form = profile_form(request.POST or None, request.FILES or None,
                        instance=request.user)
    #print 'GET: %s' % request.GET
    #print 'POST: %s' % request.POST
    #print 'form valid? %s %s' % (form.is_valid(), form.errors)
    if request.method == "POST" and form.is_valid():
        user = form.save()
        info(request, _("Profile updated"))
        #print 'GET: %s' % request.GET
        #print 'POST: %s' % request.POST
        try:
            if 'next' in request.GET:
                return redirect(request.GET.get("next", "/"))
            return redirect("profile", username=user.username)
        except NoReverseMatch:
            return redirect("profile_update")
    context = {"form": form, "title": _("Update Profile")}
    return render(request, template, context)
开发者ID:orlenko,项目名称:sfpirg,代码行数:23,代码来源:views.py



注:本文中的mezzanine.accounts.get_profile_form函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python accounts.get_profile_model函数代码示例发布时间:2022-05-27
下一篇:
Python pair_trade_analysis.TradeAnalysis类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap