Sunday, April 2, 2017

Re: Not able to paginate with TemplateResponseMixin view

On Sunday, 2 April 2017 15:23:35 UTC+1, Rajesh Benjwal wrote:
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


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.

--
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/7ffb1b65-ddde-4b40-8487-e40c67445c34%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment