As masklinn says, zip: http://docs.python.org/library/functions.html#zip
Combine the two lists in python into one list of pairs (tuples). change the render_to_response line to: render_to_response(filter_obj.html', {'zipped': zip(obj1, obj2), 'q':query}) zip discards any elements that are left over in the longer list. and the the {% for %} becomes: {% for smth1, smth2 in zipped %} You don't need the {% if %} because the for already does that: http://docs.djangoproject.com/en/dev/ref/templates/builtins/#for Cheers, Dave On Jan 16, 8:25 am, gintare <g.statk...@gmail.com> wrote: > Hello, > > I am sorry for asking a simple question. > (I read other answer bout iteration in several items in this user > group - they are too complicated for me. I have no time to study > Django deeper. ) > I want to iterate over two lists simultaneously in form which is > simple (.html), do not described in models.py or admin.py > > ## views.py > obj1=mod1.filter(field__contains='smth1').order('-date') > obj2=mod2.filter(field__contains='smth2').order('-date') > > return render_to_response('filter_obj.html', {'List1':obj1, 'List2': > obj2, 'q': query }) > > ## filter_obj.html > > {% if List1 %} > {% for smth1, smth2 in List1, List2 %} > .... > ???? how to iterate here ? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.