gsmith wrote: > > Hello, > I have a template file that when shown is going to be populated by > data from two different tables. I want to use the generic view > 'list_detail.object_list'. However, as far as I know I can only pass > one queryset to the object_list view. Is there a way that I can pass > two QuerySet's? > > For example this is how it works now > > rso_news_info = { > "queryset" : news.objects.all(), > "template_object_name" : "news", > } > > I am wondering if I can use something like > > rso_news_info = { > "queryset" : news.objects.all(), > "queryset" : leftnav.objects.all() > "template_object_name" : "news", > } > > So that I would be able to have two block tags in my template > news_list.html that display the data from both tables. > > Any help would be appreciated.
I suggest you using extra_context parameter to add your objects within. Ex : urlpatterns = patterns('', (r'^$', 'django.views.generic.list_detail.object_list', dict(queryset= Post.objects.all(),extra_context={'all_tags': Tag.objects.all(), 'all_categories': Category.objects.all(),} )), ) Nicolas --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---