Hi,
I've decided to teach myself Django and I'm enjoying the tutorial which I've so far found exceptionally detailed but I'm a bit confused by the get_queryset function in the IndexView class.
Essentially my question is what calls this function?
Is it automatically called when the class is used? I appreciate this is part of a generic view and it's a built-in function, so that makes some sense to me, but it's not clear.
I've looked elsewhere in the documentation, at the generic views in particular and whilst get_queryset is used in another example, I see that it isn't a mandatory requirement, as other examples have just a model or queryset assignment, the latter of which shows a filtered assignment.
So is the get_queryset just a way of automatically creating a queryset attribute?
I'm not seeing any advantage to this at present to a more simple, queryset =
I guess I need to finish the tutorial but if someone could help me understand how this fit together, I would be most grateful.
Regards,
Tony
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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/30c20c46-c9ba-46dd-a3d8-c717b87c341b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment