I have an app called Blog. In my models.py there is a class BaseEntry and classes that inherit from it like SimpleEntry and TitledEntry. For the index view I want all the Entries in one list.
I defined my list view like this.
class BlogListView(ListView):
model = BaseEntry
template_name = 'blog/index.html'
paginate_by = 5
I’m thinking I could do something like this:
BaseEntry.objects.all()
Then I could go through the list and retrieve the child instances by their parents ids.
Or instead I could do something like this right away:
SimpleEntry.objects.all()
TitledEntry.objects.all()
The thing that bothers me: I define the view to work with a particular model, but then I work with a different model. On the other hand the documentation says this:
“A QuerySet
that represents the objects. If provided, the value of queryset
supersedes the value provided for model
.”
Am I taking the model attribute too serious or could I run into trouble with thie second approach?