本文整理汇总了Python中archeologicaladdressbook.model.Session.delete方法的典型用法代码示例。如果您正苦于以下问题:Python Session.delete方法的具体用法?Python Session.delete怎么用?Python Session.delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类archeologicaladdressbook.model.Session
的用法示例。
在下文中一共展示了Session.delete方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_04_cascade_delete
# 需要导入模块: from archeologicaladdressbook.model import Session [as 别名]
# 或者: from archeologicaladdressbook.model.Session import delete [as 别名]
def test_04_cascade_delete(self):
""" Test for cascade delete between `VoluntaryMember` and `Person` models."""
v_member = Session.query(model.VoluntaryMember).filter_by().first()
Session.delete(v_member)
Session.commit()
person = Session.query(model.Person).filter_by(person_id=v_member.person_id).count()
assert person == 0
示例2: test_04_cascade_delete
# 需要导入模块: from archeologicaladdressbook.model import Session [as 别名]
# 或者: from archeologicaladdressbook.model.Session import delete [as 别名]
def test_04_cascade_delete(self):
""" Test for cascade delete on the `Photo` model."""
person = Session.query(model.Person).filter_by().first()
Session.delete(person)
Session.commit()
photos = Session.query(model.Photo).filter_by(person_id=person.person_id).count()
assert photos == 0
示例3: test_04_cascade_delete
# 需要导入模块: from archeologicaladdressbook.model import Session [as 别名]
# 或者: from archeologicaladdressbook.model.Session import delete [as 别名]
def test_04_cascade_delete(self):
""" Test for cascade delete on the `Address` model."""
person = Session.query(model.Person).filter_by().first()
Session.delete(person)
Session.commit()
addresses = Session.query(model.Address).filter_by(person_id=person.person_id).count()
assert addresses == 0
示例4: test_03_cascade_delete
# 需要导入模块: from archeologicaladdressbook.model import Session [as 别名]
# 或者: from archeologicaladdressbook.model.Session import delete [as 别名]
def test_03_cascade_delete(self):
""" Test for cascade delete on the `Excavation` model."""
person = Session.query(model.Person).filter_by().first()
Session.delete(person)
Session.commit()
excavations = Session.query(model.Excavation). \
filter_by(person_id=person.person_id).count()
assert excavations == 0
示例5: delete
# 需要导入模块: from archeologicaladdressbook.model import Session [as 别名]
# 或者: from archeologicaladdressbook.model.Session import delete [as 别名]
def delete(self, id=None):
""" Delete an existing address record."""
address = Session.query(Address).get(id)
if address:
Session.delete(address)
Session.commit()
flash_message(_("Address record deleted"), 'success')
return redirect(url.current(action='index'))
else:
flash_message(_("This record did not exist"), 'warning')
return redirect(url.current(action='index', id=None))
示例6: delete
# 需要导入模块: from archeologicaladdressbook.model import Session [as 别名]
# 或者: from archeologicaladdressbook.model.Session import delete [as 别名]
def delete(self, id=None):
""" Delete an existing excavation record."""
excavation = Session.query(Excavation).get(id)
if excavation:
Session.delete(excavation)
Session.commit()
flash_message(_("Excavation record deleted"), 'success')
return redirect(url.current(action='index'))
else:
flash_message(_("This record did not exist"), 'warning')
return redirect(url.current(action='index', id=None))