[Fixed]-Django Rest Framework view get_queryset is called twice

22πŸ‘

βœ…

Then when this ModelViewset is called the first time every work correctly until the return sentence then the get_queryset method is called again. I want to know why?

If you’re using the BrowsableAPI, it’ll call the get_queryset again in order to display the forms.

Other detail is that when the second exception is raised in the first get_queryset call, this is show as rest framework normal template but if it is raised in the second called, it is show in the django error template with the traceback and error messages.

No idea about that one. This may be the sign that you have another exception during the processing of the initial exception.
However, get_queryset is not supposed to raise exceptions.

πŸ‘€Linovia

Leave a comment