Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide csrf token in get method in the django

How can I hide the CSRF token from the get method in the Django? When we call the get method then only the parameters need to visible in the browser URL rather than the CSRF token.

like image 465
beginners Avatar asked Nov 16 '25 16:11

beginners


1 Answers

The CSRF protection ignores GET requests (see how it works). Therefore you can simply remove {% csrf_token%} from the form in your template.

<form method="get" action=".">
  {% csrf_token %}<!-- remove this line -->
  {{ form }}
</form>
like image 97
Alasdair Avatar answered Nov 19 '25 08:11

Alasdair



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!