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)
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)
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)
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) sform1 = SearchForm1() context = { 'setting': setting, 'category': category, 'form': form, 'sform1': sform1 } return render(request, 'contact.html', context)
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)
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')
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)
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)
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)
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)
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 for your message.') return HttpResponseRedirect('/contactus') contactform = ContactForm() setting = Setting.objects.get(pk=1) category = Category.objects.all() context = {'setting': setting, 'form': contactform, 'category': category} return render(request, 'contactus.html', context)
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 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)
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)
def contact(request): if request.method == 'POST': form = CotactForm(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 murojatingiz qabul qilindi") return HttpResponseRedirect('/contact/') setting = Setting.objects.all() form = CotactForm category = Category.objects.all() context = { 'setting': setting, 'form': form, 'category': category, } return render(request, 'contact.html', context)
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() current_user = request.user shopcart = ShopCart.objects.filter(user_id=current_user.id) total = 0 for rs in shopcart: if rs.product.variant == 'None': total += rs.product.price * rs.quantity else: total += rs.variant.price * rs.quantity form = ContactForm context = { 'setting': setting, 'form': form, 'shopcart': shopcart, 'total': total, #'category': category } return render(request, 'contact.html', context)