Exemplo n.º 1
0
def contact(request):
    if request.method == "POST":
        name = request.POST['name']
        email = request.POST['email']
        message = request.POST['message']
        ins = models.Contact(name=name, message=message, email=email)
        ins.save()
        print("your data has been saved to db")
    return render(request, 'contact.html')
Exemplo n.º 2
0
def contact(request):
    if request.method == "POST":
        name = request.POST['name']
        email = request.POST['email']
        phone = request.POST['phone']
        # password = request.POST['password']
        desc = request.POST['desc']
        # print(name, email, phone, password, desc)
        ins = models.Contact(name=name, email=email, phone=phone, desc=desc)
        ins.save()
        print('database updated')
    # return HttpResponse("Thid is my contactpage (/contact)")
    return render(request, 'contact.html')
Exemplo n.º 3
0
def contacts(request):
    if request.method == "POST":
        print("This is post")
        name = request.POST['name']
        email = request.POST['email']
        phone = request.POST['phone']
        desc = request.POST['desc']
        # print(name,email,phone,desc)
        ins = models.Contact(name=name, email=email, phone=phone, desc=desc)
        ins.save()
        print("The data has been written to the db")

    # return HttpResponse("This is contact")
    return render(request, "contact.html")
Exemplo n.º 4
0
def contact(request):
    if request.method == 'POST':
        name = request.POST.get('contname')
        email = request.POST.get('contmail')
        phone = request.POST.get('contno')
        desc = request.POST.get('contdesc')
        if len(name) < 2 or len(email) < 3 or len(phone) < 10 or len(desc) < 4:
            messages.error(request, 'Please fill the form correctly!')
        else:
            messages.success(request, 'Form has been filled successfully!')
            xcontact = models.Contact(name=name,
                                      email=email,
                                      contact=phone,
                                      desc=desc)
            xcontact.save()

    return render(request, 'home/contact.html')
Exemplo n.º 5
0
def iletisim(request):
    settings = Settings.objects.all()
    deger = 0
    if (request.method == 'POST'):
        ad = request.POST['ad']
        email = request.POST['email']
        konu = request.POST['konu']
        mesaj = request.POST['mesaj']
        veri = models.Contact(ad=ad, mail=email, konu=konu, mesaj=mesaj)
        veri.save()
        deger = "İşleminiz başarıyla gerçekleşmiştir.."
    else:
        deger = ""
    context = {
        'deger': deger,
        'settings': settings,
    }
    return render(request, 'iletisim.html', context, locals())