コード例 #1
0
def betaSignup():
	form = ContactForm()

	if request.method == 'POST':
		name = request.form['name']
		email = request.form['email']

		form.name=name
		form.email=email
		form.message="Good Luck!"

		# if form.name != "" and form.email!= "" and form.message != "":
		# 	msg = Message("Beta Signup!", sender='*****@*****.**', recipients=['*****@*****.**'])
		# 	msg.body = """
		# 	Registered: %s <%s>
		# 	%s
		# 	""" % (form.name, form.email, form.message)
		# 	mail.send(msg)
		# 	print("message sent")

		EmailObject = Emails(name=name,email=email)
		session.add(EmailObject)
		session.commit()
	
	return render_template('index.html', form=form)
コード例 #2
0
ファイル: webapp.py プロジェクト: Loai17/Top-Perfume
def home():
    form = ContactForm()

    loadMore = False
    # brands = ast.literal_eval(json.dumps(autoBrand()))
    brandShowList = session.query(
        Brands).all()  #brandShow()#ast.literal_eval(json.dumps(brandShow()))
    varBrandShow = []
    if len(brandShowList) >= 8:
        for i in range(8):
            varBrandShow.append(brandShowList[i])
    else:
        varBrandShow = brandShowList

    if len(varBrandShow) < len(brandShowList):
        loadMore = True

    if request.method == 'POST':
        form.name = request.form['name']
        form.email = request.form['email']
        form.message = request.form['message']

        if form.name != "" and form.email != "" and form.message != "":
            msg = Message("Top Perfum Message",
                          sender='*****@*****.**',
                          recipients=['*****@*****.**'])
            msg.body = """
			From: %s <%s>
			Message: %s
			""" % (form.name, form.email, form.message)
            mail.send(msg)
            print("message sent")

            return render_template('index.html',
                                   success=True,
                                   form=form,
                                   number=1,
                                   brands=varBrandShow,
                                   loadMore=loadMore)
        else:
            return render_template('index.html',
                                   form=form,
                                   number=1,
                                   brands=varBrandShow,
                                   loadMore=loadMore)

    return render_template('index.html',
                           form=form,
                           number=1,
                           brands=varBrandShow,
                           loadMore=loadMore)
コード例 #3
0
def bugReporting():
	form = ContactForm()

	if request.method == 'POST':
		form.name = request.form['name']
		form.email = request.form['email']
		form.message = request.form['message']

		if form.name != "" and form.email!= "" and form.message != "":
			msg = Message("Bug Report", sender='*****@*****.**', recipients=['*****@*****.**'])
			msg.body = """
			From: %s <%s>
			Message: %s
			""" % (form.name, form.email, form.message)
			mail.send(msg)
			print("message sent")

			return render_template('bugReport.html',done=True)
	
	return render_template('bugReport.html')