Example #1
0
def create(request):
    form = SubscriptionForm(request.POST)

    if not form.is_valid():
        context = RequestContext(request, {'form': form})
        return render_to_response('subscription/new.html', context)

    subscription = form.save()

    send_subscription_email(subscription)
    return HttpResponseRedirect(reverse('subscription:success', args=[ subscription.pk ]))
Example #2
0
def create(request):
    form = SubscriptionForm(request.POST)

    if not form.is_valid():
        context = RequestContext(request, {"form": form})
        return render_to_response("subscription/new.html", context)

    subscription = form.save()
    # notifica o cadastro
    send_subscription_email(subscription)
    return HttpResponseRedirect(reverse("subscription:success", args=[subscription.pk]))
Example #3
0
def create(request):
    form = SubscriptionForm(request.POST)
    if not form.is_valid():
        context = RequestContext(request, {'form': form})
        return render_to_response('subscription/new.html', context)

    subscription = Subscription()
    subscription.name = form.cleaned_data['name']
    subscription.cpf = form.cleaned_data['cpf']
    subscription.email = form.cleaned_data['email']
    subscription.phone = form.cleaned_data['phone']
    subscription.save()
    send_subscription_email(subscription)

    return HttpResponseRedirect(reverse('subscription:success', args=[subscription.pk]))
Example #4
0
    def form_valid(self, form):
        response = super(SubscriptionCreateView, self).form_valid(form)
        # envia email
        send_subscription_email(self.object)

        return response
Example #5
0
    def form_valid(self, form):
        response = super(SubscriptionCreateView, self).form_valid(form)
        # envia email
        send_subscription_email(self.object)

        return response