Example #1
0
def contacto(request):
    # implement tab of contact
    if request.method=="POST":
        # """implementacion de formulario con apiforms"""
        miFromulario=FormularioContacto(request.POST)

        if miFromulario.is_valid():

            infForm=miFromulario.cleaned_data

            send_mail(infForm['asunto'], infForm['mensaje'], infForm.get('email',''),["*****@*****.**"],)
            return render(request,"gracias.html")

            # """implementacion de metodo por peticion directa"""
            # asunto=request.POST['asunto']
            # mensaje=request.POST['mensaje'] + " " + request.POST['email']
            # email_from=EMAIL_HOST_USER
            # recipient_list=["*****@*****.**"]
            # send_mail(asunto,mensaje,email_from,recipient_list)

    else:
        miFromulario=FormularioContacto()
    
    return render(request, "formulario_contacto.html", {"form": miFromulario})


    # return render(request, "contacto.html")
Example #2
0
def contacto(request):

    #if request.method=="POST":
    #
    #   subject=request.POST["asunto"]

    #  message=request.POST["mensaje"] + " " + request.POST["email"]
    # email_from=settings.EMAIL_HOST_USER
    #recipient_list=["*****@*****.**"]
    #send_mail(subject, message, email_from, recipient_list)

    #return render(request, "gracias.html")

    if request.method == "POST":

        miFormulario = FormularioContacto(request.POST)

        if miFormulario.is_valid():

            infForm = miFormulario.cleaned_data
            send_mail(
                infForm['asunto'],
                infForm['mensaje'],
                infForm.get('email', '*****@*****.**'),
                ['*****@*****.**'],
            )

            return render(request, "gracias.html")
    else:

        miFormulario = FormularioContacto()

    return render(request, "formulario_contacto.html", {"form": miFormulario})
Example #3
0
def contacto(request):
    if request.method == "POST":
        miFormulario = FormularioContacto(request.POST)
        if miFormulario.is_valid():
            infForm = miFormulario.cleaned_data
            send_mail(infForm["asunto"], infForm["mensaje"], infForm.get("email", ""),["*****@*****.**"],)
            return  render(request, "gracias.html")
    else:
        miFormulario = FormularioContacto()
    return render(request, "formulario_contacto.html", {"form": miFormulario})
Example #4
0
def contacto(request):
    if request.method == "POST":
        miFormulario = FormularioContacto(request.POST)
        if miFormulario.is_valid():
            infForm = miFormulario.cleaned_data
            send_mail(infForm['asunto'], infForm['mensaje'], 
                      infForm.get('email', ''), ['*****@*****.**'],)
            return render(request, 'gracias.html')
    else:
        miFormulario = FormularioContacto()  
    return render(request, 'contacto.html', {'form':miFormulario})
Example #5
0
def contacto(request):

    if request.method == "POST":

        miFormulario = FormularioContacto(request.POST)

        if miFormulario.is_valid():
            infForm = miFormulario.cleaned_data

            return render(request, "gracias.html")

    else:
        miFormulario = FormularioContacto()

    return render(request, "formulario_contacto.html", {"form": miFormulario})
Example #6
0
def contacto(request):

    if request.method == 'POST':
        miFormulario = FormularioContacto(request.POST)

        if miFormulario.is_valid():
            infForm = miFormulario.cleaned_data

            send_mail(infForm['asunto'], infForm['mensaje'],
                      infForm.get('email', ''), ['*****@*****.**'])

            return render(request, 'gracias.html')
    else:

        miFormulario = FormularioContacto()
    return render(request, 'formulario_contacto.html', {'form': miFormulario})
Example #7
0
def contacto(request):
    if request.method == "POST":
        miFormulario = FormularioContacto(request.POST)
        if miFormulario.is_valid():
            infForm = miFormulario.cleaned_data
            send_mail(
                infForm['asunto'],
                infForm['mensaje'],
                infForm.get('email', ''),
                ['*****@*****.**'],
            )
            return render(request, "gracias.html")
    else:
        miFormulario = FormularioContacto()

    return render(request, "formulario_contacto.html", {"form": miFormulario})
Example #8
0
def contacto(request):

    if request.method == "POST":  # si el envia informacion

        miformulario = FormularioContacto(request.POST)

        if miformulario.is_valid():
            intform = miformulario.cleaned_data

            send_mail(intform['asunto'], intform['mensaje'],
                      intform.get('email', ''), ['*****@*****.**'])

            return render(request, "gracias.html")
    else:

        miformulario = FormularioContacto()
    return render(request, "formulario_contacto.html", {"form": miformulario})
Example #9
0
def contacto(request):

    if request.method == "POST":
        miFormulario = FormularioContacto(request.POST)

        if miFormulario.is_valid():
            infForm = miFormulario.cleaned_data

            send_mail(infForm['asunto'], infForm['mensaje'],
                      infForm.get('email', ''), ['*****@*****.**'])

            return render(request, "gracias.html")

    else:
        miFormulario = FormularioContacto()

    return render(request, "formulario_contacto.html", {"form": miFormulario})
    """
Example #10
0
def contacto (request):

    if request.method=="POST":
        
        miFormulario=FormularioContacto(request.POST)

        if miFormulario.is_valid():
            
            infForm=miFormulario.cleaned_data

            art=Clientes.objects.create(nombre=infForm['asunto'],email=infForm['email'],direccion=infForm['mensaje'])

            return render(request, "gracias.html")
    
    else:

        miFormulario=FormularioContacto()

    return render(request, "formulario_contacto.html", {"form":miFormulario})
Example #11
0
def contacto(request):
    if request.method == "POST":

        miFormulario = FormularioContacto(
            request.POST
        )  #instancio la clase con un parametro request para tomar datos
        if miFormulario.is_valid():  #veo si son validos
            inf_form = miFormulario.cleaned_data  # cargo el diicionario en una variable
            send_mail(
                inf_form['asunto'],
                inf_form['mensaje'],
                inf_form.get('email', ''),
                ['*****@*****.**'],
            )
            return render(request, "gracias.html")

    else:
        miFormulario = FormularioContacto()

    return render(request, "formulario_contacto.html", {"form": miFormulario})
Example #12
0
def contacto(request):
    if request.method == "POST":
        """
		#Para Capturar los datos del formulario de forma manual
		subject=request.POST['asunto']#Asunto del mensaje
		#mensaje 
		message=request.POST['mensaje']+" "+ request.POST["email"]
		email_form=settings.EMAIL_HOST_USER #destino al q va
		
		recipient_list=["*****@*****.**"]#lista de quien lo va arecivir

		#Aqui recive la clase send_mail()
		#el asunto del mensaje
		#el mensaje
		#email de destion
		#y qui va recivirlo
		send_mail(subject,
			message,
			email_form,
			recipient_list)

		return render(request,"contacto.html")
		"""

        miFormulario = FormularioContacto(request.POST)
        if miFormulario.is_valid():
            infForm = miFormulario.cleaned_data
            send_mail(
                infForm["asunto"],
                infForm["mensaje"],
                infForm.get("email", ""),
                ["*****@*****.**"],
            )

            return render(request, "gracias.html")
    else:
        miFormulario = FormularioContacto()

    return render(request, "formulario_contacto.html", {"form": miFormulario})
Example #13
0
def contacto(request):
    if request.method == "POST":
        miFormulario = FormularioContacto(request.POST)
        if miFormulario.is_valid():
            info = miFormulario.cleaned_data
            send_mail(
                info['asunto'],
                info['mensaje'],
                info.get('email', ''),
                ['*****@*****.**'],
            )
            #subject = request.POST["asunto"]
            #message= request.POST["mensaje"] + " "+ request.POST["email"]
            #email_from = settings.EMAIL_HOST_USER
            #recipient_list = ["*****@*****.**"]

            #send_mail(subject,message,email_from,recipient_list)

            return render(request, "gracias.html")
    else:
        miFormulario = FormularioContacto()

    return render(request, "formulario_contacto.html", {'form': miFormulario})
Example #14
0
def contacto(request):
    if request.method == 'POST':  # si ha pulsado el boton de enviar

        miFormulario = FormularioContacto(request.POST)

        if miFormulario.is_valid():

            infform = miFormulario.cleaned_data  # variable info de formulario
            send_mail(
                infform['asunto'],
                infform['mensaje'],
                infform.get('email', '*****@*****.**'),
                ['*****@*****.**'],
            )  # get --> para enviar la info --> '' tambien se puede dejar sin correo
            # [correo del destinatario]
            return render(request, 'gracias.html')
    else:

        miFormulario = FormularioContacto(
        )  # es vacio--> ya que aun no ha pulsado en enviar

    return render(
        request, 'formulario_contacto.html', {'form': miFormulario}
    )  # en {lo que va utilizar }/ este crea automaticamente un formulario con coidgos html
Example #15
0
def contacto(request):
    """
    if request.method =="POST":

        subject=request.POST["asunto"]
        message= request.POST["mensaje"] + " " + request.POST["email"]
        email_from=settings.EMAIL_HOST_USER
        recipient_list=["*****@*****.**"]
        send_mail(subject, message, email_from, recipient_list)
        return render(request, "gracias.html")
    return render(request, "contacto.html")
    """

    if request.method=="POST":
        miFormulario=FormularioContacto(request.POST)
        if miFormulario.is_valid():
            infForm= miFormulario.cleaned_data
            send_mail(infForm['asunto'], infForm['mensaje'], 
                infForm.get('email',''), ['*****@*****.**'])
            return render(request,"gracias.html")
    else: 
        miFormulario=FormularioContacto()

    return render(request, "formulario_contacto.html", {"form": miFormulario})