Michal, Thanks very much for your reply.

I guessed, that is something like in your example.
And I find it in template.

So the conclusion is that there is no more allowed in django template engine to use *for* loop with less elements to unpack,
and I think that is also consistent and more pythonic.

Best regards
Ogi


On 17.07.2017 16:08, Michal Petrucha wrote:
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/3478a2a2-166a-df65-9ca8-35873b2aa008%40redcor.ch.
For more options, visit https://groups.google.com/d/optout.

Reply via email to