Exemple #1
0
def contactus(request):
    if request.method == 'POST':
        form = ContactForm(request.POST)
        if form.is_valid():
            # send and save data
            data = ContactMessage()
            data.name = form.cleaned_data['name']
            data.email = form.cleaned_data['email']
            data.phone = form.cleaned_data['phone']
            data.subject = form.cleaned_data['subject']
            data.message = form.cleaned_data['message']
            data.ip = request.META.get('REMOTE_ADDR')
            data.save()
            # send and save data
            messages.success(request, "پیام شما با موفقیت ارسال شد")
            return HttpResponseRedirect('/contactus')

    setting = Setting.objects.get(pk=1)
    category = Category.objects.all()
    form = ContactForm
    context = {
        'setting': setting,
        'form': form,
        'category': category,
    }
    return render(request, 'contact.html', context)
Exemple #2
0
def car_details(request, id, slug):
    if request.method == 'POST':
        form = ContactForm(request.POST)
        car = Car.objects.get(pk=id)
        if form.is_valid():
            data = ContactFormMessage()
            data.send_to = car.owner
            data.name = form.cleaned_data['name']
            data.email = form.cleaned_data['email']
            data.subject = form.cleaned_data['subject']
            data.message = form.cleaned_data['message']
            data.ip = request.META.get('REMOTE_ADDR')
            data.save()
            messages.success(request,
                             "the message has been send successfully ")
            return redirect(request.META['HTTP_REFERER'])
    setting = Setting.objects.get()
    car = Car.objects.get(pk=id)
    form = ContactForm()
    images = Image.objects.filter(cars_id=id)
    #category = Category.objects.all()
    context = {
        'setting': setting,
        # 'category': category,
        'car': car,
        'images': images,
        'form': form,
    }
    return render(request, 'car_details.html', context)
Exemple #3
0
def contactus(request):
    # if this is a POST request we need to process the form data
    if request.method == 'POST':
        # create a form instance and populate it with data from the request:
        form = ContactForm(request.POST)
        # check whether it's valid:
        if form.is_valid():
            data = ContactMessages()  #create relation with model
            data.name = form.cleaned_data['name']  # get from input data
            data.email = form.cleaned_data['email']
            data.subject = form.cleaned_data['subject']
            data.telephone = form.cleaned_data['telephone']
            data.message = form.cleaned_data['message']
            data.ip_address = request.META['REMOTE_ADDR']
            data.save()  # save data to table
            messages.success(
                request,
                "Your message has been sent. Thank You for your Contacting us we would get back to you shortly"
            )
            return HttpResponseRedirect('/contact')
    setting = Setting.objects.get(pk=1)
    category = Category.objects.all()
    form = ContactForm
    context = {'setting': setting, 'category': category, 'form': form}
    return render(request, 'contact.html', context)
Exemple #4
0
def contactus(request):
    currentlang = request.LANGUAGE_CODE[0:2]
    #category = categoryTree(0,'',currentlang)
    if request.method == 'POST':  # check post
        form = ContactForm(request.POST)
        if form.is_valid():
            data = ContactMessage()  #create relation with model
            data.name = form.cleaned_data['name']  # get form input data
            data.email = form.cleaned_data['email']
            data.subject = form.cleaned_data['subject']
            data.message = form.cleaned_data['message']
            data.ip = request.META.get('REMOTE_ADDR')
            data.save()  #save data to table
            messages.success(
                request,
                "Your message has ben sent. Thank you for your message.")
            return HttpResponseRedirect('/contact')

    defaultlang = settings.LANGUAGE_CODE[0:2]
    currentlang = request.LANGUAGE_CODE[0:2]
    setting = Setting.objects.get(pk=1)
    if defaultlang != currentlang:
        setting = SettingLang.objects.get(lang=currentlang)

    form = ContactForm
    context = {'setting': setting, 'form': form}
    return render(request, 'contactus.html', context)
Exemple #5
0
def iletisim(request):
    current_user = request.user
    if current_user.is_active:
        current_user = UserProfile.objects.get(user_id=current_user.id)
    if request.method == 'POST':
        form = ContactForm(request.POST)
        if form.is_valid():
            data = ContactFormMessage()
            data.name = form.cleaned_data['name']
            data.email = form.cleaned_data['email']
            data.subject = form.cleaned_data['subject']
            data.message = form.cleaned_data['message']
            data.ip = request.META.get('REMOTE_ADDR')
            data.save()
            messages.success(
                request,
                "Mesajınız başarı ile gönderilmiştir. Teşekkür ederiz.")
            return HttpResponseRedirect('/iletisim')

    setting = Settings.objects.get(pk=1)
    form = ContactForm()
    category = Category.objects.all()
    context = {
        'setting': setting,
        'page': 'iletisim',
        'category': category,
        'current_user': current_user,
        'form': form
    }
    return render(request, 'iletisim.html', context)
Exemple #6
0
def contact(request):
    if request.method == 'POST':
        form = ContactForm(request.POST)

        if form.is_valid():
            data = ContactFormMessage()
            data.name = form.cleaned_data['name']
            data.email = form.cleaned_data['email']
            data.subject = form.cleaned_data['subject']
            data.message = form.cleaned_data['message']
            data.ip = request.META.get('REMOTE_ADDR')
            data.save()
            messages.success(
                request,
                "Mesajınız başarı ile gönderilmiştir. Teşekkür ederiz.")
            return HttpResponseRedirect('/contact')

    setting = Setting.objects.get(pk=1)
    category = Category.objects.all()
    current_user = request.user
    shop_cart = ShopCart.objects.filter(user_id=current_user.id)
    total = 0
    for rs in shop_cart:
        total += rs.product.price * rs.quantity
    form = ContactForm()
    context = {
        'setting': setting,
        'form': form,
        'category': category,
        'total': total,
    }
    return render(request, 'contact.html', context)
Exemple #7
0
def contact(request):
    if request.method == "POST":
        form = ContactForm(request.POST)
        if form.is_valid():
            data = Contact_message()
            data.first_name = form.cleaned_data['first_name']
            data.last_name = form.cleaned_data['last_name']
            data.email = form.cleaned_data['email']
            data.address = form.cleaned_data['email']
            data.city = form.cleaned_data['city']
            data.country = form.cleaned_data['country']
            data.telephone = form.cleaned_data['telephone']
            data.save()
            messages.success(request, 'your message has been sent')
            return HttpResponseRedirect('/contact')

    setting = Settings.objects.get(pk=1)
    category = Category.objects.all()
    form = ContactForm
    context = {
        'setting': setting,
        'form': form,
        'category': category,
    }
    return render(request, 'contact.html', context)
def contact(request):
    if request.method == 'POST':  # form post edildiyse
        form = ContactForm(request.POST)
        if form.is_valid():
            data = ContactFormMessage()  # model ile bağlantı kur
            data.name = form.cleaned_data['name']  # formdan bilgiyi al
            data.email = form.cleaned_data['email']
            data.subject = form.cleaned_data['subject']
            data.message = form.cleaned_data['message']
            data.ip = request.META.get('REMOTE_ADDR')
            data.save()  # veritabanına kaydet
            messages.success(
                request,
                "Mesajınız başarı ile gönderilmiştir. Teşekkür ederiz")
            return HttpResponseRedirect('/contact')

    setting = Setting.objects.get(pk=1)
    category = Category.objects.all()
    form = ContactForm()
    context = {
        'setting': setting,
        'page': 'contact',
        'form': form,
        'category': category
    }
    return render(request, 'contact.html', context)
Exemple #9
0
def contactus(request):
    # if this is a POST request we need to process the form data
    if request.method == 'POST':
        # create a form instance and populate it with data from the request:
        form = ContactForm(request.POST)
        # check whether it's valid:
        if form.is_valid():

            contactdata = ContactMessage()
            contactdata.name = form.cleaned_data['name']
            contactdata.email = form.cleaned_data['email']
            contactdata.subject = form.cleaned_data['subject']
            contactdata.message = form.cleaned_data['message']
            contactdata.ip = request.META.get('REMOTE_ADDR')
            contactdata.save()

            messages.success(
                request,
                "Your message has been sent. Thank You for your interest ")
            return HttpResponseRedirect('/contact')

    setting = Setting.objects.get(pk=1)
    category = Category.objects.all()
    form = ContactForm
    context = {'setting': setting, 'form': form, 'category': category}
    return render(request, 'contact.html', context)
Exemple #10
0
def contactus(request):
    if request.method == 'POST':
        form = ContactForm(request.POST)
        if form.is_valid():
            data = ContactMessage()
            data.name = form.cleaned_data['name']
            data.email = form.cleaned_data['email']
            data.subject = form.cleaned_data['subject']
            data.message = form.cleaned_data['message']
            data.ip = request.META.get('REMOTE_ADDR')
            data.save()
            messages.success(request, "Your message was delivered")
            return HttpResponseRedirect('/contact')
    category = Category.objects.all()
    setting = Setting.objects.get(pk=1)
    form = ContactForm
    current_user = request.user
    shopcart = ShopCart.objects.filter(user_id=current_user.id)

    total = 0
    for rs in shopcart:
        total += rs.product.price * rs.quantity
    added = 0
    for rs in shopcart:
        added += rs.quantity
    context = {
        'setting': setting,
        'total': total,
        'added': added,
        'form': form,
        'category': category
    }
    return render(request, 'contact.html', context)
Exemple #11
0
def contactus(request):
    if request.method == 'POST':  # check post
        form = ContactForm(request.POST)
        if form.is_valid():
            data = ContactMessage()  # create relation with model
            data.name = form.cleaned_data['name']  # get form input data
            data.email = form.cleaned_data['email']
            data.subject = form.cleaned_data['subject']
            data.message = form.cleaned_data['message']
            data.ip = request.META.get('REMOTE_ADDR')
            data.save()  # save data to table
            messages.success(
                request,
                "Your message has ben sent. Thank you for your message.")
            return HttpResponseRedirect('/contact')
Exemple #12
0
def contact_form(request):
    if request.method == 'POST':
        form = ContactForm(request.POST)
        if form.is_valid():

            contactdata = Contact()
            contactdata.name = form.cleaned_data['name']
            contactdata.email = form.cleaned_data['email']
            contactdata.subject = form.cleaned_data['subject']
            contactdata.save()
            messages.success(
                request,
                "Your message has been sent ,Thank you for your interest")
            return HttpResponseRedirect('/contact')
    else:
        form = ContactForm()
    return render(request, 'contact.html', {'form': form})
def iletisim(request):
    if request.method == 'POST':
        form = ContactForm(request.POST)
        if form.is_valid():
            data = ContactFormMessage()
            data.name = form.cleaned_data['name']
            data.email = form.cleaned_data['email']
            data.subject = form.cleaned_data['subject']
            data.message = form.cleaned_data['message']
            data.save()
            messages.success(
                request, "Mesajınız Başarı İle Gönderilmiştir. Teşekkürler.")
            return HttpResponseRedirect('/iletisim')

    settings = Setting.objects.get(pk=1)
    form = ContactForm()
    context = {'settings': settings, 'form': form}
    return render(request, 'iletisim.html', context)
Exemple #14
0
def Contact(request):
    if request.method == 'POST':
        form = ContactForm(request.POST)
        if form.is_valid():
            data = ContactFormMessage()
            data.name = form.cleaned_data['name']
            data.email = form.cleaned_data['email']
            data.subject = form.cleaned_data['subject']
            data.message = form.cleaned_data['message']
            data.ip = request.META.get('REMOTE_ADDR')
            data.save()
            messages.success(request, "Mesajınız Gönderilmiştir. Teşekkürler!")
            return HttpResponseRedirect('/Contact')
    setting = Settings.objects.get(pk=1)
    category = Category.objects.all()
    form = ContactForm()
    context = {'setting': setting, 'form': form, 'category': category}
    return render(request, 'Contact.html', context)
Exemple #15
0
def iletisim(request):
    if request.method == 'POST': #form post edildiyse
        form = ContactForm(request.POST)
        if form.is_valid():
            data = ContactFormMessage()
            data.name = form.cleaned_data['name']
            data.email = form.cleaned_data['email']
            data.subject = form.cleaned_data['subject']
            data.message = form.cleaned_data['message']
            data.ip = request.META.get('REMOTE_ADDR')
            data.save()
            messages.success(request, "Mesajınız Gönderildi")
            return HttpResponseRedirect('/iletisim')

    settings = Setting.objects.get(pk=1)
    form = ContactForm()
    context = {'settings': settings, 'form': form}
    return render(request, 'iletisim.html', context)
Exemple #16
0
def contactus(request):
    if request.method == 'POST':
        form = ContactForm(request.POST)
        if form.is_valid():
            data = ContactMessage()
            data.name = form.cleaned_data['name']
            data.email = form.cleaned_data['email']
            data.subject = form.cleaned_data['subject']
            data.message = form.cleaned_data['message']
            data.ip = request.META.get('REMOTE_ADDR')
            data.save()
            messages.success(request, "Your message has been sent. Thank you.")
            return HttpResponseRedirect('/contact')

    setting = Setting.objects.get(pk=1),
    form = ContactForm
    context = {'setting': setting, 'form': form}
    return render(request, 'contactus.html', context)
Exemple #17
0
def contact(request):
    if request.method == 'POST':  # form post edildiyse
        form = ContactForm(request.POST)
        if form.is_valid():
            data = ContactFormMessage()  # model ile bağlantı kur
            data.name = form.cleaned_data['name']  # formdan bilgiyi al
            data.email = form.cleaned_data['email']
            data.subject = form.cleaned_data['subject']
            data.message = form.cleaned_data['message']
            data.ip = request.META.get('REMOTE_ADDR')
            data.save()  # veritabanına kaydet
            messages.success(request,
                             "Your message send successfully. Thank you.")
            return HttpResponseRedirect('/contact')

    setting = Setting.objects.get(pk=1)
    form = ContactForm()
    context = {'setting': setting, 'category': category, 'form': 'form'}
    return render(request, 'contact.html', context)
Exemple #18
0
	def post(self, request):
		form = ContactForm()		
		args = {'form': form}
		
		form_info = ContactForm(request.POST)
		if form_info.is_valid():
			first_name = request.POST.get('first_name', '')
			last_name = request.POST.get('last_name', '')
			email_address = request.POST.get('email', '')
			subject = request.POST.get('subject', '')
			message = request.POST.get('message', '')

			# email the profile with contact info
			
#			template = get_template('contact_template.txt')
#			context = {
#			'first_name': first_name,
#			'last_name': last_name,
#			'email': email,
#			'subject': subject,
#			'message': message,
#			}
#			content = template.render(context)
#			email = EmailMessage(
#				"New contact form submission",
#				content,
#				subject +'',
#				['*****@*****.**'],
#				headers = {'Reply-To': email }
#			)
#			email.send()
			email = EmailMessage (
				subject = subject,
				body=('You have a query:\n{}\nFrom\n{} {}'.format(message, first_name, last_name)),
				from_email='*****@*****.**',
				reply_to=[email_address],
				to=['*****@*****.**',],
				headers={'Content-Type': 'text/plain'})
			email.send()

			args.update({'success':True})
		return render(request, self.template_name, args)
Exemple #19
0
def contactus(request):
    if request.method == 'POST':
        form = ContactForm(request.POST)
        if form.is_valid():
            data = ContactMessage()
            data.name = form.cleaned_data['name']
            data.email = form.cleaned_data['email']
            data.subject = form.cleaned_data['subject']
            data.message = form.cleaned_data['message']
            data.ip = request.META.get('REMOTE_ADDR')
            data.save()
            messages.success(request, "Sizning xabaringiz yuborildi! Rahmat")
            return HttpResponseRedirect('/contact')
    setting = Setting.objects.all()
    form = ContactForm
    context = {
        'setting': setting,
        'form': form,
    }
    return render(request, 'contact.html', context)
Exemple #20
0
def contactus(request):
    if request.method == "POST":  #check postg
        form = ContactForm(request.POST)
        if form.is_valid():
            data = ContactMessage()  # create relation with model
            data.name = form.cleaned_data['name']  #get form input data
            data.email = form.cleaned_data['email']
            data.subject = form.cleaned_data['subject']
            data.message = form.cleaned_data['message']
            data.ip = request.META.get('REMOTE_ADDR')
            data.save()
            messages.success(
                request,
                'Your message has been sent. Thank you for your message')
            return HttpResponseRedirect('/contact')

    setting = Setting.objects.get(pk=1)
    form = ContactForm
    context = {'setting': setting, 'form': form}
    return render(request, 'contactus.html', context)
Exemple #21
0
def contact_form(request):
    # if this is a POST request we need to process the form data
    if request.method == 'POST':
        # create a form instance and populate it with data from the request:
        form = ContactForm(request.POST)
        # check whether it's valid:
        if form.is_valid():

            contactdata=Contact()
            contactdata.name =  form.cleaned_data['name']
            contactdata.email = form.cleaned_data['email']
            contactdata.subject = form.cleaned_data['subject']
            contactdata.message = form.cleaned_data['message']
            contactdata.save()

            messages.success(request, "Your message has been sent. Thank You for your interest ")
            return HttpResponseRedirect('/contact')
    else:
        form = ContactForm()
    return render(request, 'contact.html', {'form': form})
Exemple #22
0
def contactUs(request):
    if request.method == 'POST':

        form = ContactForm(request.POST)
        if form.is_valid():
            data = ContactFormMessage()
            data.contact_firstName = form.cleaned_data['contact_firstName']
            data.contact_lastName = form.cleaned_data['contact_lastName']
            data.contact_email = form.cleaned_data['contact_email']
            data.contact_subject = form.cleaned_data['contact_subject']
            data.contact_message = form.cleaned_data['contact_message']
            data.save()
            messages.success(request,
                             "İletişim formunuz başarıyla gönderilmiştir.")
            return HttpResponseRedirect('/contact')

    form = ContactForm()
    context = {'form': form}

    return render(request, 'contact.html')
Exemple #23
0
def contactus(request):
    if request.method == 'POST':
        form = ContactForm(request.POST)
        if form.is_valid():
            data = ContactMessage()
            data.name = form.cleaned_data['name']
            data.email = form.cleaned_data['email']
            data.subject = form.cleaned_data['subject']
            data.message = form.cleaned_data['message']
            data.ip = request.META.get('REMOTE_ADDR')
            data.save()
            messages.success(request, "Your message has been sent. We will Get back to static as soon as possible")
            return HttpResponseRedirect('/contact')

    setting = Setting.objects.get(pk=1)
    category = Category.objects.all()
    form = ContactForm
    context = {'setting': setting, 'form': form,
               'category': category}
    return render(request, 'contact.html', context)
Exemple #24
0
def contactus(request):
    if request.method == "POST":  #check past
        form = ContactForm(request.POST)
        if form.is_valid():
            data = ContactMessage()  #create relation with model
            data.name = form.cleaned_data["name"]  # get from input data
            data.email = form.cleaned_data["email"]
            data.subject = form.cleaned_data["subject"]
            data.message = form.cleaned_data["message"]
            data.ip = request.META.get("REMOTE_ADDR")
            data.save()
            messages.success(
                request,
                "Your massage has been sent.Thank you for your messages")

            return HttpResponseRedirect("/contact")

    setting = Setting.objects.get(pk=1)
    form = ContactForm
    context = {"setting": setting, "form": form}
    return render(request, "contactus.html", context)
def contact(request):
    category = Category.objects.all()
    if request.method == 'POST':  # check post
        form = ContactForm(request.POST)
        if form.is_valid():
            data = ContactMessage()  # create relation with model
            data.name = form.cleaned_data['name']  # get form input data
            data.email = form.cleaned_data['email']
            data.subject = form.cleaned_data['subject']
            data.message = form.cleaned_data['message']
            data.ip = request.META.get('REMOTE_ADDR')
            data.save()  # save data to table
            messages.success(
                request,
                "Your message has ben sent. Thank you for your message.")
            return HttpResponseRedirect('/contact')

    form = ContactForm
    setting = Setting.objects.get(pk=1)
    context = {'setting': setting, 'category': category, 'form': form}
    return render(request, 'contact.html', context)
Exemple #26
0
def contactus(request):
    if request.method == 'POST':
        form = ContactForm(request.POST)
        if form.is_valid():
            data = ContactMessage()#create relation with model
            data.name=form.cleaned_data['name']#get form input data
            data.email = form.cleaned_data['email']
            data.subject = form.cleaned_data['subject']
            data.message = form.cleaned_data['message']
            data.ip = request.META.get('REMOTE_ADDR')
            data.save()#save data to table
            messages.success(request, "Sizning xabaringiz yuborildi, xabaringiz uchun rahmat!")
            return HttpResponseRedirect('/contact/')

    setting = Setting.objects.all()
    form = ContactForm
    category = Category.objects.all()
    context = {
        'setting': setting, 'form': form, 'category':category,
    }
    return render(request, 'contact.html', context)
Exemple #27
0
def contactus(request):
    category = Category.objects.all()
    if request.method == 'POST':
        form = ContactForm(request.POST)
        if form.is_valid():
            data = ContactMessage()  # Create relation with model
            data.name = form.cleaned_data['name']  # Get form input data
            data.email = form.cleaned_data['email']
            data.subject = form.cleaned_data['subject']
            data.message = form.cleaned_data['message']
            data.ip = request.META.get('REMOTE_ADDR')
            data.save()
            messages.success(request, "Your message has ben sent.")

    setting = Setting.objects.get(pk=1)
    form = ContactForm
    context = {
        'setting': setting,
        'form': form,
        'category': category,
    }
    return render(request, 'contactus.html', context)
Exemple #28
0
def contact(request):
    if request.method == 'POST':
        form = ContactForm(request.POST)
        if form.is_valid():
            data = ContactFormMessage()
            data.fname = form.cleaned_data['fname']
            data.lname = form.cleaned_data['lname']
            data.email = form.cleaned_data['email']
            data.subject = form.cleaned_data['subject']
            data.message = form.cleaned_data['message']
            data.ip = request.META.get('REMOTE_ADDR')
            data.save()
            messages.success(
                request,
                "Mesajınız başarı ile gönderilmiştir. Teşekkür Ederiz...")
            return HttpResponseRedirect('/contact.html')

    setting = Setting.objects.get(pk=1)
    setting.highlight_contact = "nav-link active"
    form = ContactForm()
    context = {'setting': setting, 'form': form}
    return render(request, 'contact.html', context)
Exemple #29
0
def contact_form(request):
    categoryList = Category.objects.all()
    if request.method == "POST":
        form = ContactForm(request.POST)
        if form.is_valid():
            contactdata = Contact()
            contactdata.name = form.cleaned_data['name']
            contactdata.email = form.cleaned_data['email']
            contactdata.subject = form.cleaned_data['subject']
            contactdata.message = form.cleaned_data['message']
            contactdata.save()

            messages.success(request, "Your message has been sent.")
            return HttpResponseRedirect('/contact')
    else:
        form = ContactForm()

    context = {
        'form': form,
        'categoryList': categoryList,
    }
    return render(request, 'contact.html', context)
Exemple #30
0
def iletisim(request):
    if request.method == 'POST':  #form post edildiyse
        form = ContactForm(request.POST)
        if form.is_valid():
            data = ContactFormMessage()  # model ile bağlantı kur
            data.name = form.cleaned_data['name']  # formdan bilgiyi al
            data.email = form.cleaned_data['email']
            data.subject = form.cleaned_data['subject']
            data.message = form.cleaned_data['message']
            data.ip = request.META.get('REMOTE_ADDR')
            data.save()  # veritabanına kaydet
            messages.success(request, "Mesajınız başarı ile gönderilmiştir.")
            return HttpResponseRedirect('/iletisim')
    setting = Setting.objects.get(pk=1)
    form = ContactForm(request.POST)
    last_posts = Post.objects.filter(status=True).order_by('-id')[:4]
    context = {
        'setting': setting,
        'form': form,
        'page': 'iletisim',
        'last_posts': last_posts
    }
    return render(request, 'iletisim.html', context)