Changeset a495b78 in sicp


Ignore:
Timestamp:
Jun 17, 2015, 10:31:22 AM (9 years ago)
Author:
Ing. Roldan D. Vargas G <rvargas@…>
Branches:
master
Children:
0000e70
Parents:
4b60864
Message:

se agregan instrucciones para obtener los niveles aguas arriba y abajo, asi como el año de registro de la cadena productiva resultante de una consulta

File:
1 edited

Legend:

Unmodified
Added
Removed
  • apps/simulacion/sigesic/views.py

    r73d807c ra495b78  
    111111    arc = arcs.findall('arc')
    112112
     113
     114    # Instrucción que permite obtener los niveles representados en la cadena aguas arriba y aguas abajo
     115    for a in arc:
     116        narriba = []
     117        nabajo = []
     118        for n in node:
     119            # Condición que evalúa si contiene niveles aguas arriba
     120            if a.attrib['tgt'] == '0' and n.attrib['position'] == a.attrib['src'] and n.attrib['level'] not in narriba:
     121                #Niveles Aguas Arriba
     122                narriba.append(n.attrib['level'])
     123
     124            # Condición que evalúa si contiene niveles aguas abajo
     125            elif a.attrib['src'] == '0' and n.attrib['position'] == a.attrib['tgt'] and n.attrib['level'] not in nabajo:
     126                #Niveles Aguas Abajo
     127                nabajo.append(n.attrib['level'])
     128
     129    attrs = root.find('attributes')
     130    # Variable que contiene el año de consulta de la cadena productiva
     131    anho = attrs.find('year').items()[0][1]
     132
     133
    113134    pr_id = request.GET.get('ciiu', None)
    114135
     
    116137        pr = Producto.objects.using('sigesic').get(pk=pr_id)
    117138
    118     return render_to_response("cadena_productiva.html", {'node': node, 'arc': arc, 'pr': pr},
     139    return render_to_response("cadena_productiva.html", {'node': node, 'arc': arc, 'pr': pr,
     140                                                         'narriba':narriba, 'nabajo': nabajo, 'anho': anho},
    119141                              context_instance=RequestContext(request))
Note: See TracChangeset for help on using the changeset viewer.