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')
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')
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")
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')
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')
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')
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})
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})
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")
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})
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})
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")
def get_billing_contacts(): from shop.models import Contact service_user = users.get_current_user() customer = get_customer(service_user) if not customer: logging.error("Customer not found for %s", service_user) return [] return [ContactTO.fromContactModel(c) for c in Contact.list(customer)]
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')
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')
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')
def get_service(service_email): city_service_user = users.get_current_user() city_customer = get_customer(city_service_user) service_user = users.User(email=service_email) customer = Customer.get_by_service_email(service_email) if not city_customer.can_edit_service(customer): logging.warn(u'Service %s tried to save service information for customer %d', city_service_user, customer.id) lang = get_solution_settings(city_service_user).main_language return ReturnStatusTO.create(False, translate(lang, SOLUTION_COMMON, 'no_permission')) contact = Contact.get_one(customer.key()) solution_settings = get_solution_settings(service_user) return ServiceTO(customer.id, customer.name, customer.address1, customer.address2, customer.zip_code, customer.city, customer.user_email, contact.phone_number, solution_settings.main_language, solution_settings.modules, solution_settings.broadcast_types, customer.organization_type, customer.vat, customer.website, customer.facebook_page)
def create_prospect_from_customer(customer): azzert(customer.prospect_id is None and customer.service_email) contact = Contact.get_one(customer.key()) azzert(contact) si = get_default_service_identity(users.User(customer.service_email)) prospect = Prospect(key_name=str(uuid.uuid4()) + str(uuid.uuid4())) prospect.name = customer.name prospect.address = ', '.join(filter(None, [customer.address1 + ((' ' + customer.address2) if customer.address2 else ''), customer.zip_code, customer.city, OFFICIALLY_SUPPORTED_COUNTRIES.get(customer.country, customer.country)])) prospect.phone = contact.phone_number prospect.email = contact.email prospect.type = ['establishment'] if customer.organization_type == OrganizationType.EMERGENCY: prospect.type.append('health') prospect.customer_id = customer.id prospect.status = Prospect.STATUS_CUSTOMER prospect.app_id = si.app_id solution_server_settings = get_solution_server_settings() prospect.add_comment(u'Converted customer to prospect', users.User(solution_server_settings.shop_no_reply_email)) try: result = geo_code(prospect.address) except GeoCodeZeroResultsException: try: result = geo_code(' '.join(filter(None, [customer.zip_code, customer.city, OFFICIALLY_SUPPORTED_COUNTRIES.get(customer.country, customer.country)]))) except GeoCodeZeroResultsException: logging.warn('Could not geo_code customer: %s', db.to_dict(customer)) return prospect.geo_point = db.GeoPt(result['geometry']['location']['lat'], result['geometry']['location']['lng']) customer.prospect_id = prospect.id prospect.customer_id = customer.id logging.info('Creating prospect: %s', db.to_dict(prospect, dict(prospect_id=prospect.id))) put_and_invalidate_cache(customer, prospect) return prospect
def _get_contact(): return Contact.get_one(customer)
def add_item_to_order(item): service_user = users.get_current_user() customer = get_customer(service_user) azzert(customer) contact = Contact.get_one(customer) azzert(contact) sln_settings = get_solution_settings(service_user) lang = sln_settings.main_language # Check if the customer his service isn't already enabled in this city if item.app_id in customer.app_ids: raise BusinessException( translate(lang, SOLUTION_COMMON, u'service_already_active')) def trans(): to_put = list() customer_store_order_key = Order.create_key( customer.id, Order.CUSTOMER_STORE_ORDER_NUMBER) subscription_order_key = Order.create_key( customer.id, customer.subscription_order_number) team_key = RegioManagerTeam.create_key(customer.team_id) product_key = Product.create_key(item.code) if item.app_id is not MISSING: app_key = App.create_key(item.app_id) product, customer_store_order, sub_order, app, team = db.get([ product_key, customer_store_order_key, subscription_order_key, app_key, team_key ]) if sub_order.status != Order.STATUS_SIGNED: raise BusinessException( translate(lang, SOLUTION_COMMON, u'no_unsigned_order')) # check if the provided app does exist azzert(app) else: product, customer_store_order, team = db.get( [product_key, customer_store_order_key, team_key]) # Check if the item has a correct count. # Should never happen unless the user manually recreates the ajax request.. azzert( not product.possible_counts or item.count in product.possible_counts or item.code == Product.PRODUCT_EXTRA_CITY, u'Invalid amount of items supplied') number = 0 existing_order_items = list() vat_pct = get_vat_pct(customer, team) item_already_added = False if not customer_store_order: # create new order customer_store_order = Order(key=customer_store_order_key) customer_store_order.contact_id = contact.key().id() customer_store_order.date = now() customer_store_order.vat_pct = 0 customer_store_order.amount = 0 customer_store_order.vat = 0 customer_store_order.vat_pct = vat_pct customer_store_order.total_amount = 0 customer_store_order.is_subscription_order = False customer_store_order.manager = STORE_MANAGER customer_store_order.team_id = None else: order_items = OrderItem.list_by_order(customer_store_order.key()) for i in order_items: number = i.number if i.number > number else number existing_order_items.append(i) # Check if this city isn't already in the possible pending order. if hasattr(i, 'app_id') and (i.app_id == item.app_id or item.app_id in customer.app_ids): raise BusinessException( translate(lang, SOLUTION_COMMON, u'item_already_added')) else: # Check if there already is an orderitem with the same product code. # If so, add the count of this new item to the existing item. for it in order_items: if it.product_code == item.code and it.product_code not in ( Product.PRODUCT_EXTRA_CITY, Product.PRODUCT_NEWS_PROMOTION): if ( it.count + item.count ) in product.possible_counts or not product.possible_counts: it.count += item.count item_already_added = True to_put.append(it) order_item = it elif len(product.possible_counts) != 0: raise BusinessException( translate( lang, SOLUTION_COMMON, u'cant_order_more_than_specified', allowed_items=max( product.possible_counts))) if item.app_id is not MISSING: remaining_length, _ = get_subscription_order_remaining_length( customer.id, customer.subscription_order_number) subscription_order_charge_date = format_date( datetime.datetime.utcfromtimestamp(sub_order.next_charge_date), locale=lang) total = remaining_length * product.price else: total = product.price * item.count vat = total * vat_pct / 100 total_price = total + vat customer_store_order.amount += total customer_store_order.vat += vat azzert(customer_store_order.total_amount >= 0) customer_store_order.total_amount += total_price service_visible_in_translation = None if not item_already_added: order_item = OrderItem(parent=customer_store_order.key()) order_item.number = number order_item.comment = product.default_comment(customer.language) order_item.product_code = product.code if item.app_id is not MISSING: order_item.count = remaining_length service_visible_in_translation = translate( lang, SOLUTION_COMMON, 'service_visible_in_app', subscription_expiration_date=subscription_order_charge_date, amount_of_months=remaining_length, extra_city_price=product.price_in_euro, app_name=app.name) else: order_item.count = item.count order_item.price = product.price if item.app_id is not MISSING: order_item.app_id = item.app_id to_put.append(order_item) to_put.append(customer_store_order) db.put(to_put) return order_item, service_visible_in_translation try: order_item, service_visible_in_translation = run_in_xg_transaction( trans) return OrderItemReturnStatusTO.create(True, None, order_item, service_visible_in_translation) except BusinessException, exception: return OrderItemReturnStatusTO.create(False, exception.message, None)
def _update_signup_contact(customer, signup): contact = Contact.get_one(customer.key()) first_name, _, last_name = signup.customer_name.partition(' ') update_contact(customer.id, contact.id, first_name, last_name, signup.customer_email, signup.customer_telephone)