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