本文整理汇总了Python中sgs.model.DBSession.delete方法的典型用法代码示例。如果您正苦于以下问题:Python DBSession.delete方法的具体用法?Python DBSession.delete怎么用?Python DBSession.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sgs.model.DBSession
的用法示例。
在下文中一共展示了DBSession.delete方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post_delete
# 需要导入模块: from sgs.model import DBSession [as 别名]
# 或者: from sgs.model.DBSession import delete [as 别名]
def post_delete(self, id, **kw):
DBSession.delete(DBSession.query(TipoItem).get(id))
redirect('/desarrollo/tipo_item/list')
示例2: post_delete
# 需要导入模块: from sgs.model import DBSession [as 别名]
# 或者: from sgs.model.DBSession import delete [as 别名]
def post_delete(self, id, **kw):
"""Metodo invocado para eliminar un item especificado"""
identity = request.environ.get('repoze.who.identity')
if identity is not None:
user = identity.get('user')
idi = user.id_usuario
rol_lider = DBSession.query(RolUsuario).filter(RolUsuario.id_usuario==idi).\
filter(Rol.group_name=="lider").filter(Rol.id_rol == RolUsuario.id_rol).all()
if(len(rol_lider)==0):
eliminar = DBSession.query(Usperfa).filter(Usperfa.id_fase==id_fase).\
filter(Permiso.permission_name=="eliminar_item").\
filter(Usperfa.id_permiso==Permiso.id_permiso).\
filter(RolUsuario.id_usuario==idi).all()
if len(list)==0:
flash("No posee los permisos para eliminar los items de la fase",'error')
redirect("/desarrollo/item/error")
else:
list_relaciones = DBSession.query(Relacion.id_relacion).filter(Relacion.id_item1==id).all()
for i in list_relaciones:
DBSession.delete(DBSession.query(Relacion).get(i))
item = DBSession.query(Item).get(int(id))
identity = request.environ.get('repoze.who.identity')
if identity is not None:
user = identity.get('user')
idi = user.id_usuario
ahora = time.localtime()
anho = str(ahora.tm_year)
mes = str(ahora.tm_mon)
dia = str(ahora.tm_mday)
hora = str(ahora.tm_hour)
min = str(ahora.tm_min)
seg = str(ahora.tm_sec)
historial = Historial()
historial.cod_recurso = item.cod_item
historial.tipo_recurso = "Item"
historial.nombre_recurso = item.nombre_item
historial.operacion = "Eliminacion"
historial.fecha_operacion = anho+'-'+mes+'-'+dia
historial.hora = hora+':'+min+':'+seg
historial.nombre_usuario = user.user_name
DBSession.add(historial)
DBSession.delete(DBSession.query(Item).get(id))
redirect('/desarrollo/item/list/'+str(self.id_fase))
else:
list_relaciones = DBSession.query(Relacion.id_relacion).filter(Relacion.id_item1==id).all()
for i in list_relaciones:
DBSession.delete(DBSession.query(Relacion).get(i))
item = DBSession.query(Item).get(int(id))
identity = request.environ.get('repoze.who.identity')
if identity is not None:
user = identity.get('user')
idi = user.id_usuario
ahora = time.localtime()
anho = str(ahora.tm_year)
mes = str(ahora.tm_mon)
dia = str(ahora.tm_mday)
hora = str(ahora.tm_hour)
min = str(ahora.tm_min)
seg = str(ahora.tm_sec)
historial = Historial()
historial.cod_recurso = item.cod_item
historial.tipo_recurso = "Item"
historial.nombre_recurso = item.nombre_item
historial.operacion = "Eliminacion"
historial.fecha_operacion = anho+'-'+mes+'-'+dia
historial.hora = hora+':'+min+':'+seg
historial.nombre_usuario = user.user_name
DBSession.add(historial)
DBSession.delete(DBSession.query(Item).get(id))
redirect('/desarrollo/item/list/'+str(self.id_fase))
示例3: post_delete
# 需要导入模块: from sgs.model import DBSession [as 别名]
# 或者: from sgs.model.DBSession import delete [as 别名]
def post_delete(self, id, **kw):
DBSession.delete(DBSession.query(Fase).get(id))
redirect('/desarrollo/fase/list')
示例4: post_delete
# 需要导入模块: from sgs.model import DBSession [as 别名]
# 或者: from sgs.model.DBSession import delete [as 别名]
def post_delete(self, id, **kw):
DBSession.delete(DBSession.query(Rol).get(id))
redirect('/administracion/rol/list')
示例5: post_delete
# 需要导入模块: from sgs.model import DBSession [as 别名]
# 或者: from sgs.model.DBSession import delete [as 别名]
def post_delete(self, id, **kw):
DBSession.delete(DBSession.query(DetalleItem).get(id))
redirect('/desarrollo/detalle_item/list')
示例6: post_delete
# 需要导入模块: from sgs.model import DBSession [as 别名]
# 或者: from sgs.model.DBSession import delete [as 别名]
def post_delete(self, id, **kw):
DBSession.delete(DBSession.query(Usuario).get(id))
redirect('/administracion/usuario/list')
示例7: post_delete
# 需要导入模块: from sgs.model import DBSession [as 别名]
# 或者: from sgs.model.DBSession import delete [as 别名]
def post_delete(self, id, **kw):
DBSession.delete(DBSession.query(Relacion).get(id))
redirect('/desarrollo/relacion/list')
示例8: post_delete
# 需要导入模块: from sgs.model import DBSession [as 别名]
# 或者: from sgs.model.DBSession import delete [as 别名]
def post_delete(self, id, **kw):
DBSession.delete(DBSession.query(Proyecto).get(id))
redirect('/administracion/proyecto/list')