You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314
  1. from django.middleware.csrf import get_token
  2. from django.utils.functional import lazy
  3. from django.utils.html import format_html
  4. from django.utils.safestring import SafeText
  5. def csrf_input(request):
  6. return format_html(
  7. '<input type="hidden" name="csrfmiddlewaretoken" value="{}">',
  8. get_token(request))
  9. csrf_input_lazy = lazy(csrf_input, SafeText, str)
  10. csrf_token_lazy = lazy(get_token, str)