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


Python ItemManager.getByCodigo方法代码示例

本文整理汇总了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 &nbsp;  </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 &nbsp;  </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 &nbsp; </a>'\
#                        '</div>'\
#                        '<div><a href="/item/desaprobar?id_item='+str(obj.id_item)+'" style="text-decoration:none">Desaprobar &nbsp; </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 &nbsp;</a>'\
#                        '</div>'

        else:
            value = '<div></div>'
        value +='</div>'
        return value
开发者ID:vanecan,项目名称:SGP14,代码行数:50,代码来源:item.py

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


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