From 09e1e3a74c484c4d2fac01b7e2497510756fb9ac Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 12 Jul 2025 08:57:47 +0530 Subject: [PATCH] Update documentation with CSRF token requirements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add CSRF token section to Frontend JavaScript Requirements - Document both manual FormData and HTML form approaches - Clarify when {% csrf_token %} is needed in templates - Reference recent data analyzer CSRF fix 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- docs/CLAUDE.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/CLAUDE.md b/docs/CLAUDE.md index 2f6b666..77245a6 100644 --- a/docs/CLAUDE.md +++ b/docs/CLAUDE.md @@ -494,6 +494,22 @@ The project uses a clean, modular individual agent architecture: - resetForm() // Prepares for next request ``` +#### CSRF Token Requirements +All agent templates that use JavaScript form submission must include: +```html + +{% csrf_token %} +``` + +For manual FormData submission (like data analyzer), access token via: +```javascript +// For templates with {% csrf_token %} tag +formData.append('csrfmiddlewaretoken', document.querySelector('[name=csrfmiddlewaretoken]').value); + +// For HTML forms with {% csrf_token %} inside form +const formData = new FormData(this); // 'this' refers to form element - automatically includes CSRF +``` + #### Template Requirements ```html