当前位置: 首页>>代码示例>>Python>>正文


Python Customer.registered方法代码示例

本文整理汇总了Python中models.Customer.registered方法的典型用法代码示例。如果您正苦于以下问题:Python Customer.registered方法的具体用法?Python Customer.registered怎么用?Python Customer.registered使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Customer的用法示例。


在下文中一共展示了Customer.registered方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: landing_submit

# 需要导入模块: from models import Customer [as 别名]
# 或者: from models.Customer import registered [as 别名]
def landing_submit():
	registration_form = RegistrationForm() 
	#TODO: save registration

	customer = Customer("Aaron Evans", "[email protected]", "425-242-4304", "One Shore Inc")

	if registration_form.tell_me_more.data == True:
		return redirect(url_for('details')) #TODO: we can't remove the anchor
	
	if registration_form.sign_up.data == True:

		if registration_form.validate_on_submit():

			return redirect('register')


			return redirect(url_for('register'), code=307)


	contact_form = ContactForm()

	if registration_form.validate_on_submit():
		#TODO: save registration
		customer = Customer(
			name = registration_form.name.data,
			email = registration_form.email.data,
			phone = registration_form.phone.data,
			company = registration_form.company.data
		)
		if registration_form.tell_me_more.data == True:
			customer.registered = 0
			db.session.add(customer)
			db.session.commit()
			return redirect(url_for('details', _anchor='registered')) #TODO: we can't remove the anchor
		if registration_form.sign_up.data == True:
			db.session.add(customer)
			db.session.commit()
			return redirect(url_for('order', _anchor='registered'))
	else:
		session['name'] = registration_form.name.data
		session['email'] = registration_form.email.data
		session['phone'] = registration_form.phone.data
		session['company'] = registration_form.company.data


	contact_form = ContactForm()
	if contact_form.validate_on_submit():
		# TODO: save message
		contact = Contact(
			name = contact_form.name.data,
			email = contact_form.email.data,
			phone = contact_form.phone.data,
			message = contact_form.message.data
		)
		db.session.add(contact)
		db.session.commit()
		return "message sent"

	if contact_form.send.data == True:
		if contact_form.validate_on_submit():
			return redirect(url_for('contact'))

	content = render_template('landing.html', registration_form=registration_form, contact_form=contact_form)
	return content
开发者ID:acthomas06,项目名称:qazar,代码行数:66,代码来源:routes.py


注:本文中的models.Customer.registered方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。