If I am not wrong. The issue is with the List View not Detail View. You need to provide, List View with query set. If you are providing model parameter, you will also need to give it a primary key 'pk', like you did for Detail View.
Hope that helps, Smaran On Jul 7, 2012 3:36 PM, "Soviet" <soviet1...@gmail.com> wrote: > Now that I have basic understanding of models, I encountered even more > confusing subjects - views and urls. Now, the class-generic views are quite > easy to grasp at basic level, but I fail to understand what's wrong with > this code: > > urlpatterns = patterns('', > (r'^$', ListView.as_view( > model=Car, > context_object_name="cars_list", > template_name='data/cars_list.html', > )), > (r'^(?P<pk>\d+)/$', DetailView.as_view( > model=Car, > context_object_name="car_details", > template_name='data/car_details.html', > )), > ) > > The ListView is working fine, but when I try to get the details about > single car, all I'm getting is error: "No car found matching the query". I > tried adding 'queryset = Car.objects.all()' both in urls.py and in > views.py, creating custom class, but the error persists. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/django-users/-/fQZA1sl13VkJ. > 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. > -- 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.