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


Python Place.put方法代码示例

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


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

示例1: get

# 需要导入模块: from models import Place [as 别名]
# 或者: from models.Place import put [as 别名]
 def get(self):
     place = Place(
         name='Google',
         location=ndb.GeoPt(lat=1.279,lon=103.85)
     )
     place.put()
     self.redirect('/')
开发者ID:JLtheking,项目名称:singgest,代码行数:9,代码来源:main.py

示例2: save_place

# 需要导入模块: from models import Place [as 别名]
# 或者: from models.Place import put [as 别名]
	def save_place( self, name, geojson ):
		owner = self.auth.user.auth_id
		place = Place( name=name, owner=owner, geojson=geojson )
		place.put()
		key = str( place.key() )
		self.session['current_place'] = key
		return {
			'key': str( place.key() )
		}
开发者ID:geary,项目名称:claslite,代码行数:11,代码来源:handlers.py

示例3: places

# 需要导入模块: from models import Place [as 别名]
# 或者: from models.Place import put [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)
开发者ID:gromadco,项目名称:locograph,代码行数:17,代码来源:main.py

示例4: add_places

# 需要导入模块: from models import Place [as 别名]
# 或者: from models.Place import put [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)
开发者ID:mpurdon,项目名称:Buckets,代码行数:50,代码来源:reset.py

示例5: get

# 需要导入模块: from models import Place [as 别名]
# 或者: from models.Place import put [as 别名]
 def get(self):
     name = self.request.get("name")
     place_query = Place.query().filter(name==name).fetch()
     if not place_query:
         place = Place(name=name)
         place.put()
开发者ID:crumpledpaper,项目名称:singgest,代码行数:8,代码来源:main.py


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