Ejemplo n.º 1
0
def contact(request, *args, **kwargs):
    form = EmailForm()
    if request.method == "POST":
        form = EmailForm(request.POST)
        if form.is_valid():

            send_mail(
                "Novo mensagem da nossa web", form.data["message"], form.data["email"], ["*****@*****.**"]
            )
            return redirect("/obrigado/")

    return simple.direct_to_template(request, "contact.html", extra_context={"form": form, "section": "contact"})
Ejemplo n.º 2
0
def contact(request):
    form = EmailForm()
    if request.method == 'POST':
        form = EmailForm(request.POST)
        if form.is_valid():

            send_mail(
                'Nuevo mensaje de nuestra web',
                form.data['message'],
                form.data['email'],
                [
                    '*****@*****.**',
                ],
            )
            return redirect('/gracias/')

    return render(
        request,
        'contact.html',
        {
            'form': form,
            'section': 'contact',
        }
    )