[Django]-How to return JsonResponse in Django generic ListView

5👍

You need to return the result of super() in your dispatch method.

def dispatch(self, request, *args, **kwargs):
    ... 
    return super(AjaxQuestionList, self).dispatch(request, *args, **kwargs)

Without the return statement, the method returns None so you get the error message.

Leave a comment