How to Solve NameError: name 'connection' is not defined -- django
Solution: Import the 'connection' module
# Add the following line to the top of your code
from django.db import connection
For more information:
django connection
# Add the following line to the top of your code
from django.db import connection
For more information:
django connection