Add CSRF token to templates

1
2
3
find . -type f -name "*.html" -exec sed -i \
's|\(<form[^>]*method="post"[^>]*>\)\({% csrf_token %}\)\?|\1{% csrf_token %}|g' \
{} \;

More like this

  1. csrf_token for mako by damd 3 years, 10 months ago
  2. jinja2 csrf_token extension by jasongreen 4 years, 3 months ago
  3. Ignore Csrf Middleware by coleifer 3 years, 10 months ago
  4. create_c by catellar 2 years, 7 months ago
  5. Django csrf_token Template Tag Fix by Reustle 3 years, 8 months ago

Comments

flipflop (on July 4, 2011):

That's very cool! I've been trying to do this for a while, without good results.

#

(Forgotten your password?)