On Mon, Jul 17, 2017 at 03:46:30PM +0200, Ogi Vranesic wrote: > Hi > > I have used some templates in older django versions. > But now in django 1.11 using the same templates, the error: > > ValueError: Need 2 values to unpack in for loop; got 3. > > will be raised on line 207 in module django.template.defaulttags > by the method render of class ForNode > > Actually is by me looking at code *num_loopvars = 2* and *len_item = 3*. > > After I've outcommented this part of code, some of this template as a form > is displayed and one can work on it. > > So could somebody tell me what is purpose of this two variables and > comparing of them? > > Thanks very much in advance and best regards > Ogi
Sounds like you are trying to loop over a list in your template, something like this:: {% for a, b in mylist %} ... {% endfor %} The problem is that mylist contains triples, not pairs. It would help a lot if you could show the actual template code, as well as the context that you pass to the template. Cheers, Michal -- 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 https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/20170717140802.GD23772%40koniiiik.org. For more options, visit https://groups.google.com/d/optout.
signature.asc
Description: Digital signature