def thanks_bak(request): if request.method == 'POST': # If the form has been submitted... form = ContactForm(request.POST) # A form bound to the POST if form.is_valid(): base= request.POST.get('base',None) if base =='leve1': product=request.POST.get('product',None) oldpass=request.POST.get('oldpass',None) newpass=request.POST.get('newpass',None) secondpass=request.POST.get('secondpass',None) if newpass==secondpass: list=(base,product,oldpass,newpass,secondpass) return render_to_response('exanoke.html', {'list': list}) else: product=request.POST.get('product',None) ipaddr=request.POST.get('ipaddr',None) oldpass=request.POST.get('oldpass',None) newpass=request.POST.get('newpass',None) secondpass=request.POST.get('secondpass',None) if newpass==secondpass: list=(base,product,ipaddr,oldpass,newpass,secondpass) return render_to_response('exanoke.html', {'list': list}) #return HttpResponse('fail') else: return HttpResponse('fail') else: #form = ContactForm({'base':'leve1','product':'leve1','ipaddr':'34.34.34.3','oldpass':'******','newpass':'******','secondpass':'******'}) # An unbound form form = ContactForm({'base':'leve1','product':'leve1'}) return render_to_response('exanoke.html', {'form': form,})
def contact(request): if request.method == 'POST': form = ContactForm(request.POST, instance=event) if form.is_valid(): # check if the data are good # here we can make some stuff to work on the data title = form.cleaned_data['title'] location = form.cleaned_data['location'] link = form.cleaned_data['link'] date_start = form.cleaned_data['date_start'] date_end = form.cleaned_data['date_end'] description = form.cleaned_data['description'] mail = form.cleaned_data['mail'] slug = form.cleaned_data['slug'] visibility = form.cleaned_data['visibility'] paying = form.cleaned_data['paying'] form.save(commit=False) envoi = True else: form = ContactForm() return render(request, 'event/form.html', locals())
def contact(): form = ContactForm() if form.validate_on_submit(): message = Message(content = form.content.data) message.put() flash('Thanks, your message has been submitted') return redirect(url_for('contact')) return render_template('contact.html', form=form)
def ContactMe(): form = ContactForm() if form.validate_on_submit(): pesan = Contact(name=form.name.data,email=form.email.data,phone=form.phone.data,subject=form.subject.data,message=form.message.data) db.session.add(pesan) db.session.commit() flash("Pesan anda terkirim","success") return redirect(url_for("index")) return render_template("contact.html",form=form)
def contact(): form = ContactForm() if request.method == 'POST': if form.validate() == False: flash('All fields are required.') return render_template('form.html', form=form) else: return render_template('success.html') elif request.method == 'GET': return render_template('form.html', form=form)
def contact(): f = ContactForm() if request.method == 'POST': if f.validated() == False: flash('All field required') return render_template('contact-old.html', form=f) else: return render_template('sucess.html') elif request.method == 'GET': return render_template('contact-old.html', form=f)
def about(): form = ContactForm() if request.method == 'POST': if form.validate() == False: flash('All Fields are Required') return render_template('about.html', form = form) else: return 'Form posted.' elif request.method == 'GET': return render_template('about.html', form = form)
def contact(): form = ContactForm() if form.validate_on_submit(): print('-------------------------') print(request.form['message']) print('-------------------------') data = JS.loads(request.form['message']) root = ET.Element("TEI") root.set("xmlns", "http://www.tei-c.org/ns/1.0") teiheader = ET.SubElement(root, "teiHeader") filedesc = ET.SubElement(teiheader, "fileDesc") titlestmt = ET.SubElement(filedesc, "titleStmt") ET.SubElement( titlestmt, "title" ).text = data['TEI']['teiHeader']['fileDesc']['titleStmt']['title'] pubstmt = ET.SubElement(filedesc, "publicationStmt") ET.SubElement( pubstmt, "p" ).text = data["TEI"]["teiHeader"]["fileDesc"]["publicationStmt"]["p"] source = ET.SubElement(filedesc, "sourceDesc") ET.SubElement( source, "p").text = data["TEI"]["teiHeader"]["fileDesc"]["sourceDesc"]["p"] text = ET.SubElement(root, "text") front = ET.SubElement(text, "front") div = ET.SubElement(front, "div") div.set("type", "sommaire") ET.SubElement( div, "head").text = data["TEI"]["text"]["front"]["div"]["head"] table = ET.SubElement(div, "table") ET.SubElement( table, "head").text = data["TEI"]["text"]["front"]["div"]["table"]["head"] row = ET.SubElement(table, "row") for i in range(0, int(request.form['nombre'])): j = 0 ET.SubElement(row, "cell").text = data["TEI"]["text"]["front"][ "div"]["table"]["row"][i]["cell"][j] ET.SubElement(row, "cell").text = data["TEI"]["text"]["front"][ "div"]["table"]["row"][i]["cell"][j + 1] body = ET.SubElement(text, "body") ET.SubElement(body, "p").text = data["TEI"]["text"]["body"]["p"] xmlstr = minidom.parseString( ET.tostring(root)).toprettyxml(indent=" ") with open( "C:/Users/aypax/PycharmProjects/Projet_Tei/Generated_xml_files/" + name, "w") as f: f.write(xmlstr) return render_template('views/success/success.html', name=name) return render_template('views/accueil/accueil.html', form=form)
def addcontact(): form = ContactForm() if form.validate_on_submit(): contact = Contact(name=form.name.data, value=form.value.data, show_on_footer="show_on_footer" in request.form, show_on_contact="show_on_contact" in request.form) db.session.add(contact) db.session.commit() return redirect(url_for("addcontact")) template = render_template("admin/contact/contacts/addcontact.html", form=form) return checkLogin(template)
def add_contact(): form = ContactForm() if form.validate_on_submit(): name = form.name.data lName = form.lname.data phone = form.phone.data cur = mysql.connection.cursor() query = "INSERT INTO contactos(nombre, apellido, numero, id_usuario) VALUES (%s,%s,%s,%s)" cur.execute(query, (name, lName, phone, current_user.id)) mysql.connection.commit() cur.close() return redirect(url_for('all_contacts')) return render_template('insert.html', form=form)
def updatecontact(id): contact = Contact.query.get(int(id)) form = ContactForm() if form.validate_on_submit(): contact.name = form.name.data contact.value = form.value.data contact.show_on_footer = "show_on_footer" in request.form contact.show_on_contact = "show_on_contact" in request.form db.session.commit() return redirect(url_for("contact")) template = render_template("admin/contact/contacts/updatecontact.html", contact=contact, form=form) return checkLogin(template)
def edit(post_id): form = ContactForm() cur = mysql.connect.cursor() cur.execute(""" SELECT * FROM contactos WHERE id_contact=%s """, [post_id]) contact = cur.fetchall() print(contact) return render_template('edit.html', form=form, contacts=contact[0])
def contact(): form = ContactForm() if request.method == 'POST': print(request.form["Age"]) if not form.validate(): flash('All fields are required.') return render_template('contact.html', form=form) else: #return display() return render_template('display_page.html', title=request.form['Age'], form=form) if request.method == 'GET': return render_template('contact.html', form=form)
def contact(): form = ContactForm() menu = [ Enlace(url_for('index'), 'Home'), Enlace(url_for('contact'), 'Contact') ] return render_template('items/contact.html', menu=menu, form=form)
def test_sends_mail_with_headers(self): reply_to_email = u'*****@*****.**' # the user's email data = { 'name': b'Test', 'phone': b'0123456789', 'email': reply_to_email, 'companyName': b'Test', 'companyAddress': b'Test address', 'companyNumber': b'01234567', 'companySector': 1, 'amount': b'10000', 'duration': b'365', 'description': b'Test message' } form = ContactForm(data=data) assert form.is_valid()
def submission(): form = ContactForm() if request.method == 'POST': return render_template('request.html', success=True) elif request.method == 'GET': return render_template('request.html', form=form)
def contact(): form = ContactForm(csrf_enabled=False) if request.method=='POST': if form.validate() == False: flash('All fields are required.') return render_template('contact.html',form=form) else: fromname = form.name.data fromaddr = form.Email.data subject = form.Subject.data msg = form.Message.data sendemail(fromaddr,fromname,subject,msg) return 'Form posted.' elif request.method=='GET': return render_template('contact.html', form=form)
def contactUs(): form = ContactForm() if request.method == 'POST': if form.validate() == False: return render_template('contactUs.html', form=form) else: msg = Message(form.subject.data, sender='*****@*****.**', recipients=['*****@*****.**']) msg.body = """ From: %s &;%s> %s """ % (form.name.data, form.email.data, form.message.data) mail.send(msg) return render_template('contactUs.html', success=True) elif request.method == 'GET': return render_template('contactUs.html', form=form)
def update_contact(id): form = ContactForm() contact = {} if form.validate_on_submit(): name = form.name.data lName = form.lname.data phone = form.phone.data cur = mysql.connection.cursor() print("{} {} {} {}".format(name, lName, phone, id)) query = "UPDATE contactos SET nombre=%s, apellido=%s, numero=%s WHERE id_contact=%s" cur.execute(query, (name, lName, phone, id)) mysql.connection.commit() cur.close() flash("Actualización Exitosa") return redirect(url_for('all_contacts'))
def contact(): form = ContactForm() if request.method == 'POST': if form.validate_on_submit(): msg = Message(form.subject.data, sender='*****@*****.**', recipients=['*****@*****.**']) msg.body = """ From: %s <%s> %s """ % (form.name.data, form.email.data, form.message.data) mail.send(msg) flash( f'Thank you for your Message {form.name.data}! I will reach out to you soon', 'success') return redirect(url_for('index')) return render_template('form.html', form=form)
def index(): form = ContactForm() if form.validate_on_submit(): newId = GetNextId("CharityInfo") print(form.charityName.data) print(form.charityEmail.data) print(form.category.data) print(form.tagLine.data) print(form.mission.data) print(form.charityWebsite.data) register_nonProfit(newId, str(form.charityName.data), str(form.charityEmail.data), str(form.category.data), str(form.tagLine.data), str(form.mission.data), str(form.charityWebsite.data)) submission_successful = True return redirect(url_for('index')) return render_template('home.html', form=form)
def getintouch(): form = ContactForm() if request.method == 'POST': if form.validate() == False: flash('All fields are required.') return render_template('getintouch.html', form=form) else: msg = Message(form.subject.data, sender='*****@*****.**', recipients=['*****@*****.**']) msg.body = """ From: %s <%s> %s """ % (form.name.data, form.email.data, form.message.data) mail.send(msg) return render_template('getintouch.html', success=True) elif request.method == 'GET': return render_template('getintouch.html', form=form)
def contact(): form = ContactForm(csrf_enabled=False) if request.method == 'POST': if form.validate() == False: flash('Please fill out all the Fields.') return render_template('contact.html', form=form) else: from_name = request.form["name"] from_email = request.form["Email"] subject = request.form["Subject"] msg = request.form["Message"] send_email(from_name, from_email, subject, msg) flash('Your email was Successfully Sent.') return redirect(url_for('home')) elif request.method == 'GET': return render_template('contact.html', form=form)
def contact(): form = ContactForm() if request.method == 'POST': if form.validate() == False: return render_template('contact.html', form=form) else: msg = Message(form.subject.data, sender=form.email.data, recipients=['*****@*****.**']) msg.body = """ From: %s <%s> %s """ % (form.name.data, form.email.data, form.message.data) mail.send(msg) return 'Message sent successfully.<br>Thanks for getting in touch, I will get back to you as soon as possible.' elif request.method == 'GET': return render_template('contact.html', form=form)
def contact(): form = ContactForm(request.form) if request.method == 'POST': if form.validate() == False: flash('All fields are required.') print('ERROR POSTING FORM') return render_template('contact.html', form=form) # send the contact form message if all went well else: msg = Message(form.subject.data, sender=app.config['MAIL_USERNAME'], recipients=['*****@*****.**']) msg.body = """ From: %s <%s> %s """ % (form.name.data, form.email.data, form.message.data) mail.send(msg) print('form was sent to server') return render_template('contact.html', form=form, success=True) elif request.method == 'GET': return render_template('contact.html', form=form)
def contact(): DeForm = ContactForm() if request.method == 'POST': if DeForm.validate() == False: flash('All fields are required.') return render_template('contact.html', form=DeForm) else: formname = DeForm.Name.data formaddr = DeForm.Email.data formsubject = DeForm.Subject.data formmsg = DeForm.Message.data data = Message(formsubject, sender=(formname, formaddr), recipients=['smtp.mailtrap.io']) data.body = formmsg mail.send(data) flash('Messsage Sent successfully', 'success') return redirect(url_for('home')) elif request.method == 'GET': return render_template('contact.html', form=DeForm)
def put(): #Doctor_Clinic_Link.query.delete() #Doctor.query.delete() #Clinic.query.delete() init_db() form = ContactForm(request.form) doc = Doctor(form.email.data, form.name.data, form.info.data) clinic = Clinic(form.clinic_name.data, form.first_addr.data, form.locality.data, form.city.data, form.pincode.data, form.country.data) db_session.add(doc) db_session.add(clinic) db_session.commit() link = Doctor_Clinic_Link(doc.email_id, clinic.id, form.start_day_booking.data, form.end_day_booking.data, form.fees.data, form.contact_num.data) db_session.add(link) db_session.commit() start_date_exp = datetime.strptime(form.start_date_exp()[-12:-2], "%Y-%m-%d") end_date_exp = datetime.strptime(form.end_date_exp()[-12:-2], "%Y-%m-%d") experience = Experience(doc.email_id, form.clinic_name.data, start_date_exp, end_date_exp) db_session.add(experience) db_session.commit() speciality = Speciality(doc.email_id, form.speciality.data) db_session.add(speciality) db_session.commit() start_date_edu = datetime.strptime(form.start_date_edu()[-12:-2], "%Y-%m-%d") end_date_edu = datetime.strptime(form.end_date_edu()[-12:-2], "%Y-%m-%d") qualification = Qualification(doc.email_id, form.college_name.data, start_date_edu, end_date_edu) db_session.add(qualification) db_session.commit() return 'Done!!!' '''
def form(): form = ContactForm() if request.method == "POST": print "POST used." es = Elasticsearch() res = es.search(index='va', doc_type="plan", body={'query': { 'match_all': {} }}) print "Got " + str(res['hits']['total']) + " hits" return render_template('resultsrefined.html', res=res['hits']['hits']) elif request.method == "GET": # return render_template("basicform.html") # return "Hello world." print "Calling render_template" return render_template('form.html', form=form)
def dataInsert(): global idseq, imgId form = ContactForm() sources = image_source(form.source.data) form.source.choices = [(x, x) for x in sources] if request.method == 'POST': if request.form['submit'] == 'Simulation': entry = PlantPhenotype.load(imgId[idseq]) matchResult = search_obj.search(entry.imglink) print(json.dumps(matchResult, indent=4)) return render_template("searchResult.html", imgPaths=json.dumps(matchResult)) if request.form['submit'] == 'Next Picture': print("next picture") print(len(imgId)) idseq += 1 print(idseq) if idseq >= len(imgId): idseq = len(imgId) - 1 entry = PlantPhenotype.load(imgId[idseq]) form.textArea.data = entry.annotation return render_template("dataInsertSec.html", name=session.get('name'), form=form, source=json.dumps(entry.imglink)) elif request.form['submit'] == 'Prev. Picture': print("prev picture") idseq -= 1 if idseq < 0: idseq = 0 entry = PlantPhenotype.load(imgId[idseq]) form.textArea.data = entry.annotation return render_template("dataInsertSec.html", name=session.get('name'), form=form, source=json.dumps(entry.imglink)) elif request.form['submit'] == 'Update Source': print("update source") print(form.source.data) imgId = [] image_source3(form.source.data) idseq = 0 entry = PlantPhenotype.load(imgId[idseq]) form.textArea.data = entry.annotation return render_template("dataInsertSec.html", name=session.get('name'), form=form, source=json.dumps(entry.imglink)) elif request.form['submit'] == 'Update Annotation': print("update annotation") entry = PlantPhenotype.load(imgId[idseq]) entry.annotation = form.textArea.data try: entry.store() entry = PlantPhenotype.load(imgId[idseq]) form.textArea.data = entry.annotation return render_template("dataInsertSec.html", name=session.get('name'), form=form, source=json.dumps(entry.imglink)) except Exception as e: flash("Entry error %s", e) entry = PlantPhenotype.load(imgId[idseq]) form.textArea.data = entry.annotation return render_template("dataInsertSec.html", name=session.get('name'), form=form, source=json.dumps(entry.imglink)) else: if sources == []: form.textArea.data = "" return render_template("dataInsertSec.html", name=session.get('name'), form=form) else: image_source3(sources[0]) entry = PlantPhenotype.load(imgId[idseq]) form.textArea.data = entry.annotation return render_template("dataInsertSec.html", name=session.get('name'), form=form, source=json.dumps(entry.imglink))
def contact(): form = ContactForm() if form.validate_on_submit(): return "Mensagem enviada com sucesso!" return render_template('contact.html', form=form)
def home(request): # entries = posts.objects.all()[:10] #imports first ten posts in # database. syncdb cannot change existing fields. # Set DEVELOPER_KEY to the "API key" value from the "Access" tab of the # Google APIs Console http://code.google.com/apis/console#access # Please ensure that you have enabled the YouTube Data API for your # project. DEVELOPER_KEY = "AIzaSyCjaTPgpDl3hzvkkI7x4ivsGIPmG73HP14" YOUTUBE_API_SERVICE_NAME = "youtube" YOUTUBE_API_VERSION = "v3" youtube = build(YOUTUBE_API_SERVICE_NAME, YOUTUBE_API_VERSION, developerKey=DEVELOPER_KEY) search_response = youtube.search().list( q="Anna Kendrick", part="id,snippet", # maxResults=options.maxResults maxResults=25).execute() videos = [] channels = [] playlists = [] for search_result in search_response.get("items", []): if search_result["id"]["kind"] == "youtube#video": videos.append( "Title: %s\nLink: http://www.youtube.com/watch?v=%s\nImgURL: %s\n" % (search_result["snippet"]["title"], search_result["id"]["videoId"], search_result["snippet"]["thumbnails"]["default"]["url"])) elif search_result["id"]["kind"] == "youtube#channel": channels.append("%s (%s)" % (search_result["snippet"]["title"], search_result["id"]["channelId"])) elif search_result["id"]["kind"] == "youtube#playlist": playlists.append("%s (%s)" % (search_result["snippet"]["title"], search_result["id"]["playlistId"])) # print "Videos:\n", "\n".join(videos), "\n" # print "Channels:\n", "\n".join(channels), "\n" # print "Playlists:\n", "\n".join(playlists), "\n" # Use my app consumer key for Twitter CONSUMER_KEY = 'aN1oMcd85D4ZxLq6Ehjw' CONSUMER_SECRET = 'pGbkwV9ijIMqz1Vm5GCc6w9ouofCvrRVQRVQ6SAU' auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) ACCESS_KEY = '207236820-8AYlLxvcg3zMidC8TxPXKMM91p0OQtvATQ8mr6Yg' ACCESS_SECRET = 'NwCvdFlySWlsMLPkdjJF8yhTI82yiJAfav530p6POXc' auth.set_access_token(ACCESS_KEY, ACCESS_SECRET) # Create API instance api = tweepy.API(auth) searchResults = api.get_user("@annakendrick47") tweet = api.user_timeline(searchResults.id) success = False email = "" title = "" text = "" if request.method == "POST": contact_form = ContactForm(request.POST) if contact_form.is_valid(): success = True email = contact_form.cleaned_data['email'] title = contact_form.cleaned_data['title'] text = contact_form.cleaned_data['text'] else: contact_form = ContactForm() ctx = { 'search': tweet, 'youtube': search_response.get("items", []), 'contact_form': contact_form, 'email': email, 'title': title, 'text': text, 'success': success } return render_to_response( 'index.html', ctx, context_instance=RequestContext( request)) # pass in our entries array to our html file.
def submit(): form = ContactForm() if form.validate_on_submit(): requests.post(url, data = form.data) return redirect('/') return render_template('client.html', form=form)
def contact(): form = ContactForm() if form.validate_on_submit(): flash("Your message was successfully sent!!!", 'success') return redirect(url_for('home')) return render_template('contact.html', title='Contact Me', form=form)
def contact_page(): form = ContactForm()
def home(request): # entries = posts.objects.all()[:10] #imports first ten posts in # database. syncdb cannot change existing fields. # Set DEVELOPER_KEY to the "API key" value from the "Access" tab of the # Google APIs Console http://code.google.com/apis/console#access # Please ensure that you have enabled the YouTube Data API for your # project. DEVELOPER_KEY = "AIzaSyCjaTPgpDl3hzvkkI7x4ivsGIPmG73HP14" YOUTUBE_API_SERVICE_NAME = "youtube" YOUTUBE_API_VERSION = "v3" youtube = build(YOUTUBE_API_SERVICE_NAME, YOUTUBE_API_VERSION, developerKey=DEVELOPER_KEY) search_response = youtube.search().list( q="Anna Kendrick", part="id,snippet", # maxResults=options.maxResults maxResults=25 ).execute() videos = [] channels = [] playlists = [] for search_result in search_response.get("items", []): if search_result["id"]["kind"] == "youtube#video": videos.append( "Title: %s\nLink: http://www.youtube.com/watch?v=%s\nImgURL: %s\n" % (search_result["snippet"]["title"], search_result["id"]["videoId"], search_result["snippet"]["thumbnails"]["default"]["url"])) elif search_result["id"]["kind"] == "youtube#channel": channels.append("%s (%s)" % (search_result["snippet"]["title"], search_result["id"]["channelId"])) elif search_result["id"]["kind"] == "youtube#playlist": playlists.append("%s (%s)" % (search_result["snippet"]["title"], search_result["id"]["playlistId"])) # print "Videos:\n", "\n".join(videos), "\n" # print "Channels:\n", "\n".join(channels), "\n" # print "Playlists:\n", "\n".join(playlists), "\n" # Use my app consumer key for Twitter CONSUMER_KEY = 'aN1oMcd85D4ZxLq6Ehjw' CONSUMER_SECRET = 'pGbkwV9ijIMqz1Vm5GCc6w9ouofCvrRVQRVQ6SAU' auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) ACCESS_KEY = '207236820-8AYlLxvcg3zMidC8TxPXKMM91p0OQtvATQ8mr6Yg' ACCESS_SECRET = 'NwCvdFlySWlsMLPkdjJF8yhTI82yiJAfav530p6POXc' auth.set_access_token(ACCESS_KEY, ACCESS_SECRET) # Create API instance api = tweepy.API(auth) searchResults = api.get_user("@annakendrick47") tweet = api.user_timeline(searchResults.id) success = False email = "" title = "" text = "" if request.method == "POST": contact_form = ContactForm(request.POST) if contact_form.is_valid(): success = True email = contact_form.cleaned_data['email'] title = contact_form.cleaned_data['title'] text = contact_form.cleaned_data['text'] else: contact_form = ContactForm() ctx = {'search': tweet, 'youtube': search_response.get( "items", []), 'contact_form': contact_form, 'email': email, 'title': title, 'text': text, 'success': success} return render_to_response('index.html', ctx, context_instance=RequestContext(request)) # pass in our entries array to our html file.
def form(): form = ContactForm() if form.validate_on_submit(): return render_template('success.html', form=form) return render_template('form.html', form=form)
def contact(): form = ContactForm() return render_template('contact.htm', form=form)