Пример #1
0
def contact(request):
    if request.user.is_authenticated:
        if request.user.profile.is_verified == "NVF" or request.user.profile.is_email_verified == "NVF":
            url = reverse("profile")
            messages.warning(request, mark_safe(msg.format(url=url)))

    if request.method == "POST":
        try:
            name = request.POST.get("name")
            email = request.POST.get("email")
            mobile = request.POST.get("mobile")
            message = request.POST.get("message")
            contact = Contact(name=name,
                              email=email,
                              mobile=mobile,
                              message=message)
            contact.save()
            response = json.dumps({"status": "success"})
            return HttpResponse(response)
        except Exception as e:
            response = json.dumps({"status": "failure"})
            return HttpResponse(response)

# messages.success(request, "Your response has been successfully recorded."
    return render(request, "blog/contact.html")
Пример #2
0
def contact(request):
    if request.method == 'POST':
        fname = request.POST.get("fname")
        lname = request.POST.get("lname")
        email = request.POST.get("email")
        phone = request.POST.get("phone")
        city = request.POST.get("city")
        state = request.POST.get("state")
        desc = request.POST.get("desc")
        # instance = Contact(fname=fname, lname=lname, email=email, phone=phone, city=city, state=state, desc=desc)
        # instance.save()

        if len(fname) < 2 or len(email) < 4 or len(phone) < 10 or len(
                desc) < 4:
            messages.error(request, "Please fill the details correctely")
        else:
            instance = Contact(fname=fname,
                               lname=lname,
                               email=email,
                               phone=phone,
                               city=city,
                               state=state,
                               desc=desc)
            instance.save()
            messages.success(request, "Your form has been sent successfully")

    return render(request, "contact.html")
Пример #3
0
def contact(request):
    index1 = Blog.objects.all().order_by('-time')[0]
    if request.method == 'POST':
        name = request.POST.get('name')
        email = request.POST.get('email')
        subject = request.POST.get('subject')
        desc = request.POST.get('desc')

        if len(name) < 2:
            messages.warning(request, "Please enter a valid name")
        elif len(email) < 3:
            messages.warning(request, 'Please enter a valid email address')
        elif len(desc) < 4:
            messages.warning(request, 'Please elaborate your concern')
        else:
            ins = Contact(name=name, email=email, desc=desc, subject=subject)
            ins.save()
            send_mail(
                subject + ' by ' + name,
                desc,
                email,
                ['*****@*****.**'],
                fail_silently=False,
            )
            print('done')
    context = {'index1': index1}
    return render(request, 'contact.html', context)
Пример #4
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')
        instance= Contact(name=name,email=email, phone=phone, desc=desc)
        instance.save()
    return render(request,'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")
        instance = Contact(name=name, email=email, phone=phone, desc=desc)
        instance.save()
    return render(request, "contact.html")
Пример #6
0
def contact(request):
    if request.method == "POST":
        name = request.POST.get("name")
        email = request.POST.get("email")
        phone_number = request.POST.get("phone_number")
        message = request.POST.get("query")
        entry = Contact(name=name, email=email, phone_num=phone_number, message=message)
        entry.save()
        
    return render(request, "contact.html")
Пример #7
0
def contact(request):
    if request.method == 'POST':
        name = request.POST['name']
        email = request.POST['email']
        phone = request.POST['phone']
        desc = request.POST['desc']

        instance = Contact(name=name, email=email, phone=phone, desc=desc)
        instance.save()

    return render(request, 'contact.html')
Пример #8
0
def contact(request):
    messages.success(request, 'Your message has been recieved')
    if request.method == 'POST':
        email = request.POST['email']
        subject = request.POST['subject']
        message = request.POST['message']
        # some checks here
        contact = Contact(email=email, subject=subject, message=message)
        contact.save()

    return render(request, 'blog/contact.html')
Пример #9
0
def contact(request):
    if request.method == 'POST':
        first_name = request.POST['first_name']
        last_name = request.POST['last_name']
        phone = request.POST['phone']
        email = request.POST['email']
        desc = request.POST['desc']
        contact = Contact(first_name=first_name, last_name=last_name,
                          phone=phone, email=email, desc=desc)
        contact.save()
    return render(request, 'contact.html')
Пример #10
0
def contact(request):
    if request.method =='POST':
        name = request.POST.get("name")
        email = request.POST.get("email")
        phone = request.POST.get("phone")
        message = request.POST.get("message")
        instance = Contact(name=name, email = email, phone =phone, message = message)
        instance.save()
        return render(request,'success.html')
    
    return render(request,'contact.html')
Пример #11
0
def contact(request):
    edito = Edito.objects.order_by('-created_at')[0]
    if request.method == 'POST':
        data = request.POST
        contact = Contact(name=data['name'], email=data["email"], subject=data["subject"], message=data["message"])
        contact = contact.save()
        contact_email(contact)
        return render(request, 'contact_success.html')
    return render(request, 'contact.html',{
        'edito': edito,
        })
Пример #12
0
def contact(request):
    #return HttpResponse('this is my contact page{/contact}')
    if request.method == 'POST':
        name = request.POST['name']
        email = request.POST['email']
        phone = request.POST['phone']
        desc = request.POST['desc']
        ins = Contact(name=name, email=email, phone=phone,desc=desc)
        ins.save()
        print('the data has been written to db')
    return render(request, 'contact.html')
Пример #13
0
def contact(request):
    if request.method == "POST":
        name = request.POST.get('name')
        email = request.POST.get('email')
        phone = request.POST.get('phone')
        adr = request.POST.get('adr')
        desc = request.POST.get('desc')
        contact = Contact(name=name , email=email, phone=phone, desc=desc, adr=adr)
        contact.save()
        messages.success(request, 'Your message has been sent')

    return render(request, 'contact.html')
Пример #14
0
def contact(request):
    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()

        return render(request, 'contact.html', {'name': name})
    else:
        return render(request, 'contact.html', {})
Пример #15
0
 def post(self, request):
     name = request.POST.get('name')
     email = request.POST.get('email')
     message = request.POST.get('message')
     if not all([name, email, message]):
         return render(request, 'contact.html', {'errmsg': '数据不完整'})
     if not re.match(r'^[a-z0-9][\w.\-]*@[a-z0-9\-]+(\.[a-z]{2,5}){1,2}$',
                     email):
         return render(request, 'contact.html', {'errmsg': '邮箱不合法'})
     temp_data = Contact(name=name, email=email, message=message)
     temp_data.save()
     return render(request, 'contact.html')
Пример #16
0
def contactfemi(request):
    form = ContactForm()
    if request.method == 'POST':
        form = ContactForm(request.POST)
        if form.is_valid():
            contact = Contact(name=form.cleaned_data["name"],
                              email_address=form.cleaned_data["email_address"],
                              message=form.cleaned_data["message"])
            contact.save()
            form = ContactForm()

    context = {"form": form}
    return render(request, 'contact.html', context)
Пример #17
0
def contact(request):
    edito = Edito.objects.order_by('-created_at')[0]
    if request.method == 'POST':
        data = request.POST
        contact = Contact(name=data['name'],
                          email=data["email"],
                          subject=data["subject"],
                          message=data["message"])
        contact = contact.save()
        contact_email(contact)
        return render(request, 'contact_success.html')
    return render(request, 'contact.html', {
        'edito': edito,
    })
Пример #18
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', '')
        # print(desc,name,phone)

        #Fetch The Data from admin Page
        contact = Contact(name=name, email=email, phone=phone, desc=desc)
        contact.save()
        messages.add_message(request, messages.WARNING, "Succefull")

    return render(request, "blog/contact.html")
Пример #19
0
def contact(request):
    if request.method == 'POST':
        name = request.POST.get('name')
        email = request.POST.get('email')
        ph = request.POST.get('ph')
        msg = request.POST.get('msg')
        if len(name) < 3 or len(email) < 5 or len(ph) < 10:
            messages.warning(request, "Please enter details correctly !")
        else:
            contact = Contact(name=name, email=email, phone=ph, message=msg)
            contact.save()
            messages.success(request, "Your message is received")

    return render(request, "home/contact.html")
Пример #20
0
def contact(request):
    if request.method == "POST":
        name = request.POST.get('name')
        email = request.POST.get('email')
        cell = request.POST.get('cell')
        desc = request.POST.get('desc')
        contact = Contact(name=name,
                          email=email,
                          cell=cell,
                          desc=desc,
                          date=datetime.today())
        contact.save()
        messages.success(request, "Submitted")

    return render(request, "contact.html")
def contact(request):
    if request.method == "POST":
        name = request.POST['name']
        email = request.POST['email']
        content = request.POST['content']
        # is_private = request.POST['is_private']
        # print(name, email, content)
        if len(name) < 2 or len(email) < 3 or len(content) < 3:
            messages.error(request, "Please fill the form correctly")
        else:
            contact = Contact(name=name, email=email, content=content)
            contact.save()
            messages.success(request,
                             "your message has been successfully sent")

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

        if len(name) < 2:
            messages.warning(request, "Please enter a valid name")
        elif len(email) < 3:
            messages.warning(request, 'Please enter a valid email address')
        elif len(desc) < 4:
            messages.warning(request, 'Please elaborate your concern')
        else:
            ins = Contact(name=name, email=email, desc=desc)
            ins.save()
    return render(request, 'contact.html')
Пример #23
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 sent")
    return render(request, 'blog/contact.html')
Пример #24
0
def contact(request):
    # return HttpResponse("This is contact")
    if request.method=="POST":
        print('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 successfully sent")
    else:
        print('not post')
    return render(request,'myblog/home/contact.html')
Пример #25
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=',name)
        print('email=',email)

        contact = Contact(name=name,email=email,desc=desc)
        contact.save()
     
        send_mail(name,desc,email,['*****@*****.**'],fail_silently=False)


        #thank = True
        return render(request,'contact.html') 

    return render(request,"contact.html")
Пример #26
0
def iletisim(request):
    if (request.method == 'POST'):
        isim = request.POST['isim']
        mail = request.POST['mail']
        telefon = request.POST['phone']
        mesaj = request.POST['message']
        contact_obj = Contact(isim=isim,
                              mail=mail,
                              telefon=telefon,
                              mesaj=mesaj)
        contact_obj.save()
        return render(request, 'blog/iletisim.html', {
            'contact_obj': contact_obj,
            'is_registered': True
        })

    else:
        return render(request, 'blog/iletisim.html', {})
Пример #27
0
def contact(request):
    if request.method == 'POST':
        listing = request.POST['listing']
        listing_id = request.POST['listing_id']
        name = request.POST['name']
        email = request.POST['email']
        phone = request.POST['phone']
        message = request.POST['message']
        user_id = request.POST['user_id']
        realtor_email = request.POST['realtor_email']

        # check user has made inquery already
        if request.user.is_authenticated:
            user_id = request.user.id
            has_contacted = Contact.objects.all().filter(listing_id=listing_id,
                                                         user_id=user_id)
            if has_contacted:
                messages.error(
                    request, 'You have already made an inquiry for this post')
                return redirect('/post/' + listing_id)

        contact = Contact(listing=listing,
                          listing_id=listing_id,
                          name=name,
                          email=email,
                          phone=phone,
                          message=message,
                          user_id=user_id)
        contact.save()

        # send mail

        send_mail('Property Listing Inquiry',
                  'There has been an inquiry for ' + listing + ' Message: ' +
                  message,
                  '*****@*****.**', [realtor_email, '*****@*****.**'],
                  fail_silently=False)

        messages.success(
            request,
            'Your request has been submited, a realtor will get back soon')
        return redirect('/post/' + listing_id)
Пример #28
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.info(request, "Please fill the form correctly")

        else:
            contact = Contact(name=name,
                              email=email,
                              phone=phone,
                              content=content)
            contact.save()
            messages.info(request,
                          "Your query/suggestion has been successfully sent")

    return render(request, "blog/contact.html")
Пример #29
0
def contact(request):
    # messages.error(request, 'you may contact us by sharing your query with us.')
    if request.method == 'POST':
        name = request.POST['name']
        email = request.POST['email']
        phone = request.POST['phone']
        content = request.POST['content']
        print(name, email, phone, 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 messages has been successfully sent")

    return render(request, 'home/contact.html')
Пример #30
0
    def post(self, request, *args, **kwargs):
        if value_judge(request, 'name', 'phone', 'email', 'position',
                       'address') is not True:
            return self.response({
                'code': API_1_CONTACT_FAIL,
                'data': request.data
            })
        else:
            contact = Contact()
            contact.name = request.data['name']
            contact.phone = request.data['phone']
            contact.email = request.data['email']
            contact.position = request.data['position']
            contact.company = request.data['company']
            contact.address = request.data['address']
            contact.save()

            import datetime
            print(datetime.datetime.now())

            return self.response({'code': 0, 'data': request.data})
Пример #31
0
def nouveau_contact(request):
    sauvegarde = False
    form = NouveauContactForm(request.POST or None, request.FILES)
    if form.is_valid():
        contact = Contact()
        contact.nom = form.cleaned_data["nom"]
        contact.adresse = form.cleaned_data["adresse"]
        contact.photo = form.cleaned_data["photo"]
        contact.save()
        sauvegarde = True

    return render(request, 'contact.html', {
        'form': form,
        'sauvegarde': sauvegarde
    })
Пример #32
0
def nouveau_contact(request):
    sauvegarde = False
    if request.method == "POST":
        form = NouveauContactForm(request.POST)
        if form.is_valid():
            contact=Contact()
            contact.nom = form.cleaned_data['nom']
            contact.prenom = form.cleaned_data['prenom']
            contact.adresse = form.cleaned_data['adresse']
            contact.email = form.cleaned_data['email']
            contact.save()

            sauvegarde = True
    else:
        form = NouveauContactForm()

    return render(request,'blog/nouveaucontact.html',locals())
Пример #33
0
def nouveau_contact(request):
    sauvegarde = False

    if request.method == "POST":
           form = NouveauContactForm(request.POST, request.FILES)
           if form.is_valid():
                   contact = Contact()
                   contact.nom = form.cleaned_data["nom"]
                   contact.adresse = form.cleaned_data["adresse"]
                   contact.photo = form.cleaned_data["photo"]
                   contact.save()

                   sauvegarde = True
    else:
           form = NouveauContactForm()

    return render(request, 'blog/nouveau_contact.html',locals())