当前位置: 首页>>代码示例>>Python>>正文


Python SubscriptionForm.save方法代码示例

本文整理汇总了Python中eventex.subscriptions.forms.SubscriptionForm.save方法的典型用法代码示例。如果您正苦于以下问题:Python SubscriptionForm.save方法的具体用法?Python SubscriptionForm.save怎么用?Python SubscriptionForm.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eventex.subscriptions.forms.SubscriptionForm的用法示例。


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

示例1: create

# 需要导入模块: from eventex.subscriptions.forms import SubscriptionForm [as 别名]
# 或者: from eventex.subscriptions.forms.SubscriptionForm import save [as 别名]
def create(request):
    form = SubscriptionForm(request.POST)
    if not form.is_valid():
        return direct_to_template(request, "subscriptions/subscription_form.html", {"form": form})

    obj = form.save()
    return HttpResponseRedirect("/inscricao/%d/" % obj.pk)
开发者ID:victornovais,项目名称:wttd,代码行数:9,代码来源:views.py

示例2: create

# 需要导入模块: from eventex.subscriptions.forms import SubscriptionForm [as 别名]
# 或者: from eventex.subscriptions.forms.SubscriptionForm import save [as 别名]
def create(request):
    form = SubscriptionForm(request.POST)
    if not form.is_valid():
        return render(request, 'subscriptions/subscription_form.html',
                      {'form': form})
    obj = form.save()
    return HttpResponseRedirect('/inscricao/%d/' % obj.pk)
开发者ID:Bigua,项目名称:Eventex,代码行数:9,代码来源:views.py

示例3: create

# 需要导入模块: from eventex.subscriptions.forms import SubscriptionForm [as 别名]
# 或者: from eventex.subscriptions.forms.SubscriptionForm import save [as 别名]
def create(request):
    form = SubscriptionForm(request.POST)
    if not form.is_valid():
        return render(request, 'subscriptions/inscricao.html', {'form': form})

    obj = form.save()
    return HttpResponseRedirect(r('subscriptions:detail', args=[obj.pk]))
开发者ID:eduardo-matos,项目名称:wttd,代码行数:9,代码来源:views.py

示例4: subscribe

# 需要导入模块: from eventex.subscriptions.forms import SubscriptionForm [as 别名]
# 或者: from eventex.subscriptions.forms.SubscriptionForm import save [as 别名]
def subscribe(request):
    if request.method == 'POST':
        form = SubscriptionForm(request.POST)
        if not form.is_valid():
            return direct_to_template(request, 'subscriptions/subscription_form.html', {'form':form})
        obj = form.save()
        return HttpResponseRedirect('/inscricao/%d/' % obj.pk)
    else:
        return direct_to_template(request, 'subscriptions/subscription_form.html', {'form':SubscriptionForm()})
        
开发者ID:marcelovaranda,项目名称:marcelovaranda,代码行数:11,代码来源:views.py

示例5: create

# 需要导入模块: from eventex.subscriptions.forms import SubscriptionForm [as 别名]
# 或者: from eventex.subscriptions.forms.SubscriptionForm import save [as 别名]
def create(request):
    form = SubscriptionForm(request.POST)

    if not form.is_valid():
        return render(request, 'subscriptions/subscriptions_form.html', {'form': form})

    subscription = form.save()

    _send_mail(subscription)

    return HttpResponseRedirect(r('subscriptions:detail', subscription.uuid))
开发者ID:gilsondev,项目名称:eventex,代码行数:13,代码来源:views.py

示例6: create

# 需要导入模块: from eventex.subscriptions.forms import SubscriptionForm [as 别名]
# 或者: from eventex.subscriptions.forms.SubscriptionForm import save [as 别名]
def create(request):
    form = SubscriptionForm(request.POST)
    if not form.is_valid():
        data = {'form': form}
        return render(request,
                      template,
                      data)

    obj = form.save()
    url = reverse('subscription:detail', args=(obj.id,))

    return HttpResponseRedirect(url)
开发者ID:eltonplima,项目名称:wttd,代码行数:14,代码来源:views.py

示例7: create

# 需要导入模块: from eventex.subscriptions.forms import SubscriptionForm [as 别名]
# 或者: from eventex.subscriptions.forms.SubscriptionForm import save [as 别名]
def create(request):
    form = SubscriptionForm(request.POST)

    if not form.is_valid():
        return render(request,'subscriptions/subscription_form.html', {'form': form})

    subscription = form.save()

    _send_mail({'subscription': subscription},
               settings.DEFAULT_FROM_EMAIL,
               'Confirmação de inscrição',
               'subscriptions/subscription_email.txt',
               subscription.email)
    return HttpResponseRedirect(r('subscriptions:detail', subscription.pk))
开发者ID:ricardoanzolin,项目名称:eventex,代码行数:16,代码来源:views.py

示例8: create

# 需要导入模块: from eventex.subscriptions.forms import SubscriptionForm [as 别名]
# 或者: from eventex.subscriptions.forms.SubscriptionForm import save [as 别名]
def create(request):
    """
    Requests with POST data need to be handled as creation.
    """
    form = SubscriptionForm(request.POST)
    if form.is_valid():
        obj = form.save()
        return HttpResponseRedirect('/inscricao/%d/' % obj.pk)
    else:
        return render(
            request,
            'subscriptions/subscription_form.html',
            {'form': form}
        )
开发者ID:davivcgarcia,项目名称:wttd-15,代码行数:16,代码来源:views.py

示例9: create

# 需要导入模块: from eventex.subscriptions.forms import SubscriptionForm [as 别名]
# 或者: from eventex.subscriptions.forms.SubscriptionForm import save [as 别名]
def create(request):
    form = SubscriptionForm(request.POST)

    if not form.is_valid():
        return render(request, "subscriptions/subscription_form.html", {"form": form})

    subscription = form.save()

    _send_mail(
        "Confirmação de inscrição",
        settings.DEFAULT_FROM_EMAIL,
        subscription.email,
        "subscriptions/subscription_email.txt",
        {"subscription": subscription},
    )

    return HttpResponseRedirect(r("subscriptions:detail", subscription.pk))
开发者ID:rafaelbarrelo,项目名称:wttd-eventex,代码行数:19,代码来源:views.py

示例10: create

# 需要导入模块: from eventex.subscriptions.forms import SubscriptionForm [as 别名]
# 或者: from eventex.subscriptions.forms.SubscriptionForm import save [as 别名]
def create(request):
    form = SubscriptionForm(request.POST)

    if not form.is_valid():
        return render(request, 'subscriptions/subscription_form.html', {'form': form})

    # Usando Model.Form - Quando o formulário está muito alinhado com o model
    subscription = form.save()

    # Usando form -> subscription = Subscription.objects.create(**form.cleaned_data)

    # Send email

    _send_email('subscriptions/subscription_email.txt', {'subscription': subscription},
                'Confirmação de inscrição', settings.DEFAULT_FROM_EMAIL, subscription.email)

    # Success feedback
    # messages.success(request, 'Inscrição realizada com sucesso!')

    return HttpResponseRedirect(r('subscriptions:detail', subscription.pk))
开发者ID:arilsonsantos,项目名称:eventex-arilsonsantos,代码行数:22,代码来源:views.py


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