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

Solution: Import the 'user_passes_test' module

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

from django.contrib.auth.decorators import user_passes_test

 

For more information:
Python django user_passes_test