python - Why do I only get the last value of a for loop in view in django? -


lets say:

y = [go, cat, jump, see] 

if did:

view:

  x in y:       x 

template:

   {{x}} 

i x=see , no other result, 1. why that? 2. how can make work? know doing in template works need values each item in array or dicitonary (unless, done in template too). thoughts?

edit. have this: session = {4,5,6,7,} saved in session, comes form full of check box choices, primary keys.

views:

 form = inlinefactory_formset(model1, model 2,extra = len(sesssion)  formset = form(instance=none ) 

in views have

{% x in session%}     {{x}} {{formset}}        {%endfor%} 

so prints number , form number. want, x pk mentioned above, want use pk name x instance , print form people know form editing.

inside loop x updated. after has run value of x last value in list.

what want loop through in template:

{% x in y %}    {{ x }} {% endfor %} 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -