On 14 sep, 16:54, "David.D" <dengyuanzh...@gmail.com> wrote: > It's a one-to-one relationship between queryset's content and > my_list's content. > > in my view > ======== > return object_list( request, > queryset=qs, > template_name='my_template.html', > extra_context={ 'my_list': > my_list, ... }, )
(snip) > > I have other solution: (snip) > [view] > zipped = [] > for qs_obj in qs: > list_value = find the list_value for qs_obj > zipped.append( ( qs_obj, list_value) ) # add them as a tuple or way simplier if the above fits your needs : return object_list( request, queryset=qs, template_name='my_template.html', extra_context={'products' : zip(qs, my_list) } ) If I may ask: how do you build that list anyway ? > [template] > {% for qs_obj, list_value in products %} > {{qs_obj}}: {{list_value}} > {% endfor %} -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.