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