@method_decorator(csrf_exempt) NameError: name 'method_decorator' is not defined @method_decorator(csrf_exempt) NameError: name 'method_decorator' is not defined django django

@method_decorator(csrf_exempt) NameError: name 'method_decorator' is not defined


The tutorial you're reading leaves out a number of crucial imports, such as the one that provides method_decorator:

from django.utils.decorators import method_decorator

It may help to follow the "View code on github" link, which takes you to a more complete file.