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


Python Place.address_to_latlng方法代码示例

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


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

示例1: home

# 需要导入模块: from models import Place [as 别名]
# 或者: from models.Place import address_to_latlng [as 别名]
def home():
  if 'email' not in session:
    return redirect(url_for('login'))

  form = AddressForm()

  places = []
  my_coordinates = (5.3109351,-1.9924259)

  if request.method == 'POST':
    if form.validate() == False:
      return render_template('home.html', form=form)
    else:
      # get the address
      address = form.address.data

      # query for places around it
      p = Place()
      my_coordinates = p.address_to_latlng(address)
      places = p.query(address)

      # return those results
      return render_template('home.html', form=form, my_coordinates=my_coordinates, places=places)

  elif request.method == 'GET':
    return render_template("home.html", form=form, my_coordinates=my_coordinates, places=places)
开发者ID:paajake,项目名称:FlaskTest,代码行数:28,代码来源:FlaskTest.py

示例2: home

# 需要导入模块: from models import Place [as 别名]
# 或者: from models.Place import address_to_latlng [as 别名]
def home():
	if 'email' not in session:
		return redirect(url_for('login'))
	
	form = AddressForm()
	places = []
	my_coordinates = (37.4221, -122.0844)
	
	if request.method == "POST":
		if form.validate() == False:
			return render_template("home.html", form=form)
		else:
			# get the address
			address = form.address.data

			# query for addresses nearby
			p = Place()

			my_coordinates = p.address_to_latlng(address)
			places = p.query(address)


			# return those results
			return render_template('home.html', form=form, my_coordinates=my_coordinates, places=places)
			

	elif request.method == "GET":
		return render_template("home.html", form=form, my_coordinates=my_coordinates, places=places)
开发者ID:hershalb,项目名称:learning-flask,代码行数:30,代码来源:routes.py

示例3: home

# 需要导入模块: from models import Place [as 别名]
# 或者: from models.Place import address_to_latlng [as 别名]
def home():
	if 'email' not in session:
		return redirect(url_for('login'))

	form = AddressForm()

	places = []
	my_coordinates = (50.45146, 30.52187) #37.4221     -122.0844

	if request.method == 'POST':
		if form.validate() == False:
			return render_template("home.html", form=form)
		else:
			address = form.address.data

			p = Place()
			my_coordinates =p.address_to_latlng(address)
			places = p.query(address)

			return render_template("home.html", 
									form=form,
									my_coordinates=my_coordinates,
									places=places)

	elif request.method == 'GET':
		return render_template("home.html", 
								form=form,
								my_coordinates=my_coordinates,
								places=places)

	return render_template("home.html")
开发者ID:phonxis,项目名称:learning-flask,代码行数:33,代码来源:routes.py

示例4: home

# 需要导入模块: from models import Place [as 别名]
# 或者: from models.Place import address_to_latlng [as 别名]
def home():
	if 'email' not in session:
		return redirect(url_for('login'))
	form = SearchForm()
	places = []
	my_coordinates = (37.4221, -122.0844)
	if request.method == "POST":
		if form.validate == False:
			return render_template("home.html", form=form)
		else:
			address = form.address.data
			p = Place()
			my_coordinates = p.address_to_latlng(address)
			places = p.query(address)
			return render_template('home.html', form=form, my_coordinates=my_coordinates, places=places)
	elif request.method == "GET":
		return render_template('home.html', form=form, my_coordinates=my_coordinates, places=places)
开发者ID:fizzere,项目名称:onemoreflask,代码行数:19,代码来源:routes.py

示例5: home

# 需要导入模块: from models import Place [as 别名]
# 或者: from models.Place import address_to_latlng [as 别名]
def home():
	if 'email' not in session:
		return redirect(url_for('login'))
	form = AddressForm()
	places = []
	my_coords = geocoder.google('Mountain View, CA').latlng
	if request.method == 'POST':
		if not form.validate():
			return render_template('home.html', form=form, my_coords=my_coords)
		else:
			address = form.address.data
			p = Place()
			my_coords = p.address_to_latlng(address)
			places = p.query(address)
			return render_template('home.html', form=form, my_coords=my_coords, places=places)
	elif request.method == 'GET':
		return render_template('home.html', form=form, my_coords=my_coords,places=places)
开发者ID:genedex,项目名称:packtpub,代码行数:19,代码来源:routes.py


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