Skip to content

Instantly share code, notes, and snippets.

@adamduren
Last active August 29, 2015 14:08
Show Gist options
  • Save adamduren/afe6ad54473f006b86a9 to your computer and use it in GitHub Desktop.
Save adamduren/afe6ad54473f006b86a9 to your computer and use it in GitHub Desktop.
EnsureCsrfCookieMixin
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import ensure_csrf_cookie
class EnsureCsrfCookieMixin(object):
@method_decorator(ensure_csrf_cookie)
def dispatch(self, *args, **kwargs):
return super(EnsureCsrfCookieMixin, self).dispatch(*args, **kwargs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment