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


Python Place.delete方法代码示例

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


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

示例1: tearDown

# 需要导入模块: from app.models.place import Place [as 别名]
# 或者: from app.models.place.Place import delete [as 别名]
 def tearDown(self):
     #delete all from users
     PlaceBook.delete().execute()
     Place.delete().execute()
     User.delete().execute()
     City.delete().execute()
     State.delete().execute()
开发者ID:johnSerrano,项目名称:airbnb_clone,代码行数:9,代码来源:place_book.py

示例2: setUp

# 需要导入模块: from app.models.place import Place [as 别名]
# 或者: from app.models.place.Place import delete [as 别名]
 def setUp(self):
     #connect to db and delete everyone in the users table
     PlaceBook.delete().execute()
     Place.delete().execute()
     User.delete().execute()
     City.delete().execute()
     State.delete().execute()
开发者ID:johnSerrano,项目名称:airbnb_clone,代码行数:9,代码来源:place_book.py

示例3: delete_place

# 需要导入模块: from app.models.place import Place [as 别名]
# 或者: from app.models.place.Place import delete [as 别名]
def delete_place(place_id):
    """
    Delete the given place
    Deletes the given place in the database.
    ---
    tags:
        - Place
    parameters:
        -
            in: path
            name: place_id
            type: integer
            required: True
            description: ID of the place
    responses:
        200:
            description: Place deleted successfully
            schema:
                $ref: '#/definitions/delete_amenity_delete_delete_200'
        404:
            description: Place was not found
        500:
            description: Request could not be processed
    """
    try:
        ''' Check if place_id exists '''
        query = Place.select().where(Place.id == place_id)
        if not query.exists():
            raise LookupError('place_id')

        ''' Delete the given place '''
        delete_place = Place.delete().where(Place.id == place_id)
        delete_place.execute()
        response = {}
        response['code'] = 200
        response['msg'] = "Place was deleted"
        return response, 200
    except LookupError as e:
        abort(404)
    except Exception as e:
        abort(505)
开发者ID:rickharris-dev,项目名称:airbnb_clone,代码行数:43,代码来源:place.py

示例4: tearDown

# 需要导入模块: from app.models.place import Place [as 别名]
# 或者: from app.models.place.Place import delete [as 别名]
 def tearDown(self):
     #delete all from places
     Place.delete().execute()
     User.delete().execute()
     City.delete().execute()
     State.delete().execute()
开发者ID:johnSerrano,项目名称:airbnb_clone,代码行数:8,代码来源:place.py


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