本文整理汇总了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)
示例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)
示例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")
示例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)
示例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)