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


Python Session.delete方法代码示例

本文整理汇总了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
开发者ID:lazaret,项目名称:archeobases,代码行数:9,代码来源:test_voluntary_member.py

示例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
开发者ID:lazaret,项目名称:archeobases,代码行数:9,代码来源:test_photo.py

示例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
开发者ID:lazaret,项目名称:archeobases,代码行数:9,代码来源:test_address.py

示例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
开发者ID:lazaret,项目名称:archeobases,代码行数:10,代码来源:test_excavation.py

示例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))
开发者ID:lazaret,项目名称:archeobases,代码行数:13,代码来源:addresses.py

示例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))
开发者ID:lazaret,项目名称:archeobases,代码行数:13,代码来源:excavations.py


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