models.Manager
I still don't get why are we using PostManager(models.Manager) and his method live() instead of keep using directly get_queryset() from PublishedPostsMixin(object). What is the advantage? At least to me it seems just less self-explicable when reading the code
Sorry You must be a logged in, registered user to answer a question.
Answers
It's less explicit if you don't ever read the models.py, yes.
What's important, though, is it keeps you from repeatedly typing that .filter() every time, potentially fat-fingering something or forgetting it.
You could also have done something like:
class PostListView(ListView):
model = Post
queryset = Post.objects.live()
but I prefer the explicitness of overriding get_queryset() in the mixin.
Everything clear :) Thanks