When you have duplicate keys in a python dict only the second gets saved. 
You can also refer to positions in tuples with . notation in templates. So 
something like:

Python code:

import numpy as npfrom django.template import Template, Context, loaderfrom 
django.conf import settings

dtype={
    'names' : ('name','offset'),
    'formats' : ('U20','U20')}

instance= np.zeros(3,dtype)


instance[0]=('xga_control_reg','008')
instance[1]=('i_cmd_REG','012')
instance[2]=('i_ee_cmd_reg','016')

t=Template(The Django Template below)
c=Context({"instance":instance})print(t.render(c))


template:

----   generated with parser version 1.09--
library ieee;
use ieee.std_logic_1164.all;

package regfile
          (
            {% for i in instance%}
                   Name is  {{i.0}}  "{{i.1}}" 
            {%endfor%}

           ).""")


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e32e61ab-ee44-420a-a17f-0bac6583af22%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to