Пример #1
0
def contact(request):
    if request.method == "POST":
        name = request.POST.get('name', '')
        email = request.POST.get('email', '')
        desc = request.POST.get('desc', '')

        #    print(name,email,phone,desc)

        if len(name) > 6 and len(email) > 15 and len(desc) > 5:
            # messages.error(request,"error")
            # else:
            contact = Contact(name=name,
                              email=email,
                              desc=desc,
                              timeStamp=datetime.today())

            # ,timestamp=datetime.today()
            contact.save()
            messages.success(request, 'Thanks for your response')
        else:
            messages.error(
                request,
                "Form Not Submitted Successfully. Please Fill The Form Correctly"
            )
            return redirect('contact')
    else:
        return render(request, 'shop/contact.html')
    return render(request, 'shop/contact.html')
Пример #2
0
def contact(request):
    if request.method == "POST":
        name = request.POST.get("name", '')
        email = request.POST.get("email", '')
        desc = request.POST.get("prob", '')
        order = Contact(name=name, email=email, desc=desc)
        order.save()
    return render(request, 'shop/contact.html')
Пример #3
0
def contact(request):
    if request.method == 'POST':
        name = request.POST.get('name','')
        email = request.POST.get('email','')
        phone = request.POST.get('phone','')
        desc = request.POST.get('desc','')
        contact = Contact(name = name, email = email, phone = phone, desc = desc)
        contact.save()
    return render(request,"shop/contact.html")
Пример #4
0
def contact(request):
    if request.method == "POST":
        name = request.POST.get('name', '')
        email = request.POST.get('email', '')
        query = request.POST.get('query', '')
        con = Contact(name=name, email=email, desc=query)
        con.save()
        messages.success(request, 'Form submission successful')
    return render(request, 'shop/contact.html')
Пример #5
0
def contact(request):
    if request.method == "POST":
        name = request.POST.get('name', '')
        email = request.POST.get('email', '')
        phone = request.POST.get('phone', '')
        desc = request.POST.get('desc', '')
        contact = Contact(name=name, email=email, phone=phone, desc=desc)
        contact.save()
        messages.info(request, "Successfully submit Your Message")
    return render(request, 'shop/contact.html')
Пример #6
0
def contact(request):
    if request.method == "POST":
        name = request.POST.get('name', '')
        email = request.POST.get('email', '')
        phone = request.POST.get('phone', '')
        desc = request.POST.get('desc', '')
        # add to contact table in database
        contact = Contact(name=name, email=email, phone=phone, desc=desc)
        contact.save()
    return render(request, 'shop/contact.html')
Пример #7
0
def contact(request):
    thank = False
    if request.method == "POST":
        name = request.POST.get('name', '')
        email = request.POST.get('email', '')
        phone = request.POST.get('phone', '')
        message = request.POST.get('message', '')
        contact = Contact(name=name, email=email, phone=phone, message=message)
        contact.save()
        thank = True
    return render(request, './shop/contact.html', {'thank': thank})
Пример #8
0
def contact(request):
    thank = False
    if request.method == "POST":
        name = request.POST.get('name', '')
        email = request.POST.get('email', "")
        phone = request.POST.get('phone', "")
        query = request.POST.get('textarea', '')
        contact = Contact(name=name, email=email, phone=phone, desc=query)
        contact.save()
        thank = True
    return render(request, 'shop/contact.html', {'thank': thank})
Пример #9
0
def contact(request):
    """ sending the data given by user to contact us table"""

    if request.method == 'POST':
        name = request.POST.get('name', '')
        email = request.POST.get('email', '')
        Phone = request.POST.get('phone', '')
        desc = request.POST.get('desc', '')
        # passing the value to contact class
        contact = Contact(name=name, email=email, phone=Phone, desc=desc)
        contact.save()  # saving the contact info to contact table
    return render(request, "shop/contact.html")
Пример #10
0
def contact(request):
    thank = False
    if request.method=="POST":
        print(request)
        name = request.POST.get('name','')
        email = request.POST.get('email', '')
        phone = request.POST.get('phone', '')
        desc = request.POST.get('desc', '')
        contact =Contact(name=name, email=email, phone=phone, desc=desc)
        contact.save()
        thank = True
    return render(request , 'shop/contact.html', {'thank': thank})
Пример #11
0
def contact(request):
    if request.method == "POST":
        name = request.POST.get("name", "")
        email = request.POST.get("email", "")
        phone = request.POST.get("phone", "")
        desc = request.POST.get("desc", "")
        contact = Contact(name=name, email=email, phone=phone, desc=desc)
        contact.save()
        param = True
        print(name, email, phone, desc)
    else:
        param = False

    return render(request, "shop/contact.html", {"param": param})
Пример #12
0
def contactus(request):
    if request.method == "POST":
        name1 = request.POST.get('name1')
        phone1 = request.POST.get('phone1')
        email1 = request.POST.get('email1')
        desc1 = request.POST.get('desc1')
        contactus = Contact(name1=name1,
                            phone1=phone1,
                            email1=email1,
                            desc1=desc1,
                            date=datetime.today())
        contactus.save()
        messages.success(request, 'Your message has been sent !!!')
    return render(request, "contactus.html")
Пример #13
0
def contact(request):
    if request.method == "POST":
        name = request.POST['name']
        email = request.POST['email']
        phone = request.POST['phone']
        content = request.POST['content']

        if len(name) < 2 or len(email) < 3 or len(phone) < 10 or len(
                content) < 4:
            messages.error(request, "Please fill the form Correctly")
        else:
            contact = Contact(name=name,
                              email=email,
                              phone=phone,
                              content=content)
            contact.save()
            messages.success(request, "Your message has been succesfully sent")
    return render(request, 'shop/contact.html')
Пример #14
0
def contact(request):
    if request.method == 'GET':
        return render(request, 'shop/contact.html')
    else:
        username = request.POST.get('Username')
        email = request.POST.get('Email')

        description = request.POST.get('Desc')
        phone = request.POST.get('Phone')
        checked = request.POST.get('Check', default="off")

        if checked == 'on':
            contact = Contact(Username=username,
                              Email=email,
                              Desc=description,
                              Phone=phone)
            contact.save()

        else:
            messages.info(request, 'Please fill all the forms field')
            return render(request, 'shop/contact')
Пример #15
0
def contact(request):

    if request.method == 'POST':

        name = request.POST.get('name', '')

        email = request.POST.get('email', '')

        phone = request.POST.get('phone', '')

        desc = request.POST.get('message', '')

        contact = Contact(Name=name,
                          Email=email,
                          Phone=phone,
                          Description=desc)

        contact.save()

        thank = True

        return render(request, 'shop/contact.html', {'thank': thank})

    return render(request, 'shop/contact.html')