In a Django template, I can use {% csrf_token %} to generate a hidden input element with the CSRF token as the value.
How do I do the same in a view? For instance,
def my_view(request):
csrf_input = somehow_generate_csrf_token_input()
return HttpResponse(csrf_input)
Follow the doc, use the processor to generate the CSRF token: