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

Solution: Import the 'get_user_model' module

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

from django.contrib.auth import get_user_model

 

For more information:
Python django get_user_model