Thanks for the reply Luigi, but when should we use queryset and when should
we use model?


On Thu, Jul 5, 2012 at 3:25 PM, Luigi Castro <virtual.emplo...@gmail.com>wrote:

> They did not provide the model parameter because ca queryset was used,
> note the following line.
>
> queryset=Poll.objects.order_by**('-pub_date')[:5]
>
>
>
>
> On Thursday, July 5, 2012 1:13:38 PM UTC-6, Sam007 wrote:
>>
>> Hey Djangoers,
>>
>> In the fourth and last part of the Django tutorials,
>>
>> urlpatterns = patterns('',
>>     url(r'^$',
>>         ListView.as_view(
>>             queryset=Poll.objects.order_by**('-pub_date')[:5],
>>             context_object_name='latest_**poll_list',
>>             template_name='polls/index.**html')),
>>     url(r'^(?P<pk>\d+)/$',
>>         DetailView.as_view(
>>             model=Poll,
>>             template_name='polls/detail.**html')),
>>     url(r'^(?P<pk>\d+)/results/$',
>>         DetailView.as_view(
>>             model=Poll,
>>             template_name='polls/results.**html'),
>>         name='poll_results'),
>>     url(r'^(?P<poll_id>\d+)/vote/$**', 'polls.views.vote'),)
>>
>>
>> There is a explanation that,
>>
>> "Each generic view needs to know what model it will be acting upon. This
>> is provided using the model parameter."
>>
>> But in the code above there was no 'model' parameter given for ListView?
>> So is model parameter only for DetailView? In the tutorial, was the generic
>> view suppose to be DetailView?
>>
>> --
>> Thanks & Regards
>> Smaran Harihar
>>
>>   --
> 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/-/VbSqnftQAVoJ.
> 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.
>



-- 
Thanks & Regards
Smaran Harihar

-- 
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.

Reply via email to