本文整理匯總了Python中sgp.managers.ItemMan.ItemManager.getByCodigo方法的典型用法代碼示例。如果您正苦於以下問題:Python ItemManager.getByCodigo方法的具體用法?Python ItemManager.getByCodigo怎麽用?Python ItemManager.getByCodigo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sgp.managers.ItemMan.ItemManager
的用法示例。
在下文中一共展示了ItemManager.getByCodigo方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __actions__
# 需要導入模塊: from sgp.managers.ItemMan import ItemManager [as 別名]
# 或者: from sgp.managers.ItemMan.ItemManager import getByCodigo [as 別名]
def __actions__(self, obj):
"""Override this function to define how action links should be displayed for the given record."""
primary_fields = self.__provider__.get_primary_fields(self.__entity__)
pklist = '/'.join(map(lambda x: str(getattr(obj, x)), primary_fields))
estado = obj.estado
lista = []
lista.append(str(obj.id_fase))
lista.append(str(obj.id_item))
if estado != 'finalizado':
value = '<div width="10em"><div><a class="edit_link" href="'+pklist+'/edit" title = "Editar" style="text-decoration:none">edit</a>'\
'</div><div>'\
'<form method="POST" action="'+pklist+'" class="button-to">'\
'<input type="hidden" name="_method" value="DELETE" />'\
'<input title = "Editar" class="delete-button" onclick="return confirm(\'Are you sure?\');" value="delete" type="submit" '\
'style="background-color: transparent; float:left; border:0; color: #286571; display: inline; margin: 0; padding: 0;"/>'\
'</form></div>'\
'<div><a href="/item/adjuntar?id_item='+pklist+'" title="Adjuntar" style="background-color: transparent; float:left; border:0; color: #286571; display: inline; margin: 0; padding: 0 5 0 0;" ><img src="/images/adjunto.png" width="17" height="17" /></a></div>'\
'<div><a href="/item/impacto?id_item='+pklist+'" title="Calcular Impacto" style="background-color: transparent; float:left; border:0; color: #286571; display: inline; margin: 0; padding: 0 5 0 0;" ><img src="/images/calculo_impacto.png" width="17" height="17" /></a></div>'
# '<div><a href="/item/impacto?id_item='+pklist+'" style="text-decoration:none">Impacto </a>'\
# '</div>'
if estado == "inicial":
value +='<div><a href="/item/listo?id_item='+pklist+'" title="Listo" style="background-color: transparent; float:left; border:0; color: #286571; display: inline; margin: 0; padding: 0 5 0 0;" ><img src="/images/listo.png" width="17" height="17" /></a></div>'
#
# '<div><a href="/item/listo?id_item='+str(obj.id_item)+'" style="text-decoration:none">Listo </a>'\
# '</div>'
if estado == 'listo':
value +='<div><a href="/item/aprobar?id_item='+pklist+'" title="Aprobar" style="background-color: transparent; float:left; border:0; color: #286571; display: inline; margin: 0; padding: 0 5 0 0;" ><img src="/images/aprobar.png" width="17" height="17" /></a></div>'\
'<div><a href="/item/desaprobar?id_item='+pklist+'" title="Desaprobar" style="background-color: transparent; float:left; border:0; color: #286571; display: inline; margin: 0; padding: 0 5 0 0;" ><img src="/images/desaprobar.png" width="17" height="17" /></a></div>'
# value += '<div><a href="/item/aprobar?id_item='+str(obj.id_item)+'" style="text-decoration:none">Aprobar </a>'\
# '</div>'\
# '<div><a href="/item/desaprobar?id_item='+str(obj.id_item)+'" style="text-decoration:none">Desaprobar </a>'\
# '</div>'
im = ItemManager()
versiones = im.getByCodigo(obj.codigo, obj.id_fase)
cantidad = len(versiones)
# for version in versiones:
# cantidad = cantidad +1
if cantidad > 1 and obj.estado != "finalizado":
value += '<div><a href="/itemRevertir/obtener?id_item='+pklist+'" title="Revertir" style="background-color: transparent; float:left; border:0; color: #286571; display: inline; margin: 0; padding: 0 5 0 0;" ><img src="/images/revert.png" width="21" height="21" /></a></div>'
# '<div><a href="/itemRevertir/obtener?id_item='+str(obj.id_item)+'" style="text-decoration:none">Revertir </a>'\
# '</div>'
else:
value = '<div></div>'
value +='</div>'
return value
示例2: __actions__
# 需要導入模塊: from sgp.managers.ItemMan import ItemManager [as 別名]
# 或者: from sgp.managers.ItemMan.ItemManager import getByCodigo [as 別名]
def __actions__(self, obj):
primary_fields = self.__provider__.get_primary_fields(self.__entity__)
pklist = '/'.join(map(lambda x: str(getattr(obj, x)), primary_fields))
estado = obj.estado
lista = []
lista.append(str(obj.id_fase))
lista.append(str(obj.id_item))
lbm = LineaBaseManager()
estado_lb = ""
if obj.id_linea_base != None:
linea_base = lbm.getById(obj.id_linea_base) #Si el item esta en una linea base
estado_lb = linea_base.estado
value = '<div>'
if obj.id_linea_base == None or obj.estado == 'revision' or estado_lb == 'liberado' or (obj.estado == 'listo' and obj.id_linea_base != None):
if EvaluarPermiso("Modificar/eliminar Item", id_fase = obj.id_fase ).is_met(request.environ):
value = '<div width="10em"><div><a class="edit_link" href="'+pklist+'/edit" title = "Editar" style="text-decoration:none">edit</a>'\
'</div><div>'\
'<form method="POST" action="'+pklist+'" class="button-to">'\
'<input type="hidden" name="_method" value="DELETE" />'\
'<input title = "Editar" class="delete-button" onclick="return confirm(\'Are you sure?\');" value="delete" type="submit" '\
'style="background-color: transparent; float:left; border:0; color: #286571; display: inline; margin: 0; padding: 0;"/>'\
'</form></div>'\
'<div><a href="/item/adjuntar?id_item='+pklist+'" title="Adjuntar" style="background-color: transparent; float:left; border:0; color: #286571; display: inline; margin: 0; padding: 0 5 0 0;" ><img src="/images/adjunto.png" width="17" height="17" /></a></div>'
value += '<div><a href="/item/impacto?id_item='+pklist+'" title="Calcular Impacto" style="background-color: transparent; float:left; border:0; color: #286571; display: inline; margin: 0; padding: 0 5 0 0;" ><img src="/images/calculo_impacto.png" width="17" height="17" /></a></div>'
if estado == "inicial" or estado == 'revision' or estado== 'desaprobado':
if EvaluarPermiso("Modificar/eliminar Item", id_fase = obj.id_fase ).is_met(request.environ):
value +='<div><a href="/item/listo?id_item='+pklist+'" title="Listo" style="background-color: transparent; float:left; border:0; color: #286571; display: inline; margin: 0; padding: 0 5 0 0;" ><img src="/images/listo.png" width="17" height="17" /></a></div>'
if estado == 'listo':
if EvaluarPermiso("Aprobar/Desaprobar Item", id_fase = obj.id_fase ).is_met(request.environ):
value +='<div><a href="/item/aprobar?id_item='+pklist+'" title="Aprobar" style="background-color: transparent; float:left; border:0; color: #286571; display: inline; margin: 0; padding: 0 5 0 0;" ><img src="/images/aprobar.png" width="17" height="17" /></a></div>'\
'<div><a href="/item/desaprobar?id_item='+pklist+'" title="Desaprobar" style="background-color: transparent; float:left; border:0; color: #286571; display: inline; margin: 0; padding: 0 5 0 0;" ><img src="/images/desaprobar.png" width="17" height="17" /></a></div>'
im = ItemManager()
versiones = im.getByCodigo(obj.codigo, obj.id_fase)
cantidad = len(versiones)
if cantidad > 1 and obj.estado != "finalizado":
if EvaluarPermiso("Modificar/eliminar Item", id_fase = obj.id_fase ).is_met(request.environ):
value += '<div><a href="/itemRevertir/?id_item='+pklist+'" title="Revertir" style="background-color: transparent; float:left; border:0; color: #286571; display: inline; margin: 0; padding: 0 5 0 0;" ><img src="/images/revert.png" width="21" height="21" /></a></div>'
else:
value += '<div><a href="/item/impacto?id_item='+pklist+'" title="Calcular Impacto" style="background-color: transparent; float:left; border:0; color: #286571; display: inline; margin: 0; padding: 0 5 0 0;" ><img src="/images/calculo_impacto.png" width="17" height="17" /></a></div>'
if ItemManager().sePuedeRelacionar(obj) and EvaluarPermiso("Crear Relacion", id_fase = obj.id_fase ).is_met(request.environ):
value+= '<div><a href="/relacion/newRelacion?id_item='+pklist+'" title="Relacionar" style="background-color: transparent; float:left; border:0; color: #286571; display: inline; margin: 0; padding: 0 5 0 0;" ><img src="/images/relaciones.png" width="17" height="17" /></a></div>'
value +='</div>'
return value