Grand, thank you for clarifying!
On Saturday, February 25, 2017 at 9:32:32 AM UTC, Melvyn Sopacua wrote:
>
> Hi Richard,
>
> On Friday 24 February 2017 15:51:15 Richard Jackson wrote:
>
> > What is the advantage of including the get_queryset(self) function in
> > a ListView? When I've run it with a very basic model ('Foo') there
> > doesn't appear to be any difference with/without it - this could well
> > be that my examples are currently too basic.
>
> There is none. The benefit of the get_queryset() method is that you can
> return something other than Foo.objects.all(). For example:
>
> class MyBlogPosts(generic.ListView):
> def get_queryset(self, request):
> return self.model.objects.filter(user=self.request.user)
> --
> Melvyn Sopacua
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/5044035d-af8b-42cc-9191-eb7151cf04ef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.