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

Solution: Import the 'Sum' module

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

from django.db.models import Sum

 

For more information:
Python django Sum