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


Python DBSession.delete方法代码示例

本文整理汇总了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')
开发者ID:majito,项目名称:is2grupo06,代码行数:5,代码来源:tipo_item.py

示例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))
开发者ID:majito,项目名称:is2grupo06,代码行数:78,代码来源:item.py

示例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')
开发者ID:majito,项目名称:is2grupo06,代码行数:5,代码来源:fase.py

示例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')
开发者ID:majito,项目名称:is2grupo06,代码行数:5,代码来源:rol.py

示例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')
开发者ID:majito,项目名称:is2grupo06,代码行数:5,代码来源:detalle_item.py

示例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')
开发者ID:majito,项目名称:is2grupo06,代码行数:5,代码来源:usuario.py

示例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')
开发者ID:majito,项目名称:is2grupo06,代码行数:5,代码来源:relacion.py

示例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')
开发者ID:majito,项目名称:is2grupo06,代码行数:5,代码来源:proyecto.py


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