本文整理汇总了Python中models.Place.title方法的典型用法代码示例。如果您正苦于以下问题:Python Place.title方法的具体用法?Python Place.title怎么用?Python Place.title使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Place
的用法示例。
在下文中一共展示了Place.title方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: places
# 需要导入模块: from models import Place [as 别名]
# 或者: from models.Place import title [as 别名]
def places(name=None):
if request.method == 'POST':
title = request.form.get('place_title', '')
info = request.form.get('place_info', '')
if title:
p = Place()
p.title = title
p.info = info
p.put()
qs = Place.all()
qs.order('added_at')
return render_template('places.html', places=qs)
示例2: add_places
# 需要导入模块: from models import Place [as 别名]
# 或者: from models.Place import title [as 别名]
def add_places(self, user):
# Add 10 Places
places = [
'the CN Tower',
'the Eiffel Tower',
'Athens Greece',
'the Great Pyramids',
'the Great Wall of China',
'the Louvre',
'the Palace of Versailles',
'Sydney Australia',
'the Grand Canyon',
'Bora Bora'
]
self.response.out.write('<hr/>Adding places to go<hr/>')
# Get all list items for the current user
query = UserListItems.gql('WHERE user = :user', user=user)
user_list_items = query.get()
if user_list_items is None:
user_list_items = UserListItems(user=user)
for name in places:
place = Place()
place.title = name
place.put()
# Add Reference to the Place from User
user_list_item = UserListItem()
user_list_item.user = user
user_list_item.list_item = place
# Update the list of items the user has
user_list_items.list_items.append(place.key())
# Add the specifics of the user list item linkage
user_list_item = UserListItem()
user_list_item.user = user
user_list_item.list_item = place
one_year = datetime.timedelta(days=365)
today = datetime.datetime.today()
user_list_item.date_due = today + one_year
user_list_item.put()
self.response.out.write('Added %s<br/>' % place)