But the ListView is working fine. And they don't use <pk> in the 
documentation, just this, which I modified to fit my model:

urlpatterns = patterns('',
    (r'^publishers/$', ListView.as_view(
        model=Publisher,
    )),
)

W dniu sobota, 7 lipca 2012 22:44:23 UTC+2 użytkownik Sam007 napisał:
>
> 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" <[email protected]> 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 [email protected].
>> 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.
>>
>

-- 
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/-/2RYQ-kplLroJ.
To post to this group, send email to [email protected].
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.

Reply via email to