Not able to paginate with TemplateResponseMixin view

21 views
Skip to first unread message

Rajesh Benjwal

unread,
Apr 2, 2017, 10:23:35 AM4/2/17
to Django users
I was trying to paginate course list view but not able to do it. I tried puting paginated_by in views and this


code in the template but it seems like it does work that way and I am missing something.


This is views.py



this is the related template 


I removed the pagination code as It was not working at all.

It looks like I am clueless about how to paginate. I would appeariciate any ahel. Thanks

Daniel Roseman

unread,
Apr 2, 2017, 2:49:15 PM4/2/17
to Django users
Well, the problem is precisely that you are subclassing TemplateResponseMixin, rather than a class that actually contains support for pagination. You shouldn't be doing that, you should be subclassing ListView. For the same reason, you should not override the `get` method; you should use `get_queryset` to add the annotation to your Course query, and `get_context_data` to get the subjects.
--

DR.
Reply all
Reply to author
Forward
0 new messages