[Answered ]-How to add pagination : super()

1👍

It might be better to do this in the .get_queryset(…) method:

def get_queryset(self):
    if 'learner_id' in self.kwargs:
        learner_id = self.kwargs['learner_id']
    else:
        learner_id = self.request.learner.id
    return super().get_queryset().filter(learner_id=learner_id)

then the boilerplate code to filter, paginate, etc. the view are still implemented by the .list(…) method of the ListModelMixin.

Leave a comment