How to Solve NameError: name 'Subquery' is not defined -- django

Solution: Import the 'Subquery' module

To Solve the error, add the following line to the top of your code.

from django import Subquery

 

For more information:
Python django Subquery