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

Solution: Import the 'ContentType' module

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

from django.contrib.contenttypes.models import ContentType

 

For more information:
Python django ContentType