# What's the meaning of CSRF ATTACK in Django?

**URL:** <https://forum.codewithmosh.com/t/whats-the-meaning-of-csrf-attack-in-django/29137>\
**Category:** Django\
**Created:** [October 5, 2024, 11:20pm UTC](https://forum.codewithmosh.com/t/whats-the-meaning-of-csrf-attack-in-django/29137 "2024-10-05T23:20:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yasser](https://avatars.discourse-cdn.com/v4/letter/y/5f9b8f/32.png) [@yasser](https://forum.codewithmosh.com/u/yasser)\
**Post date:** [October 5, 2024, 11:20pm UTC](https://forum.codewithmosh.com/t/whats-the-meaning-of-csrf-attack-in-django/29137/1 "2024-10-05T23:20:41Z")

</div>

When I submit a form, it gives me an error for csrf attack. so what’s csrf attack?

---

<div class="post-metadata">

**Author:** ![lucidlear](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/lucidlear/32/5477_2.png) [@lucidlear](https://forum.codewithmosh.com/u/lucidlear)\
**Post date:** [October 5, 2024, 11:39pm UTC](https://forum.codewithmosh.com/t/whats-the-meaning-of-csrf-attack-in-django/29137/2 "2024-10-05T23:39:35Z")

</div>

make sure to include a csrf token in your django forms front end like this. This is a security feature from django

```auto
<form method="post">
    {% csrf_token %}
    <!-- Form fields go here -->
    <button type="submit">Submit</button>
</form>

```

---

<div class="post-metadata">

**Author:** ![yasser](https://avatars.discourse-cdn.com/v4/letter/y/5f9b8f/32.png) [@yasser](https://forum.codewithmosh.com/u/yasser)\
**Post date:** [October 6, 2024, 2:25pm UTC](https://forum.codewithmosh.com/t/whats-the-meaning-of-csrf-attack-in-django/29137/3 "2024-10-06T14:25:28Z")

</div>

but I ask why we use CSRF attack. Can you explain why?
