htmx django
via PatrickJS/awesome-cursorrules
HTMX development with Django integration, templates, and best practices.
What is htmx django?
This rule provides guidance for building interactive web applications using HTMX with Django. It covers template integration, form handling, URL routing, class-based views, and proper CSRF protection to streamline HTMX-Django development workflows.
- Use Django's template system with HTMX attributes for dynamic interactions
- Implement Django forms and ORM for form handling and database operations
- Utilize Django's class-based views and URL routing for HTMX responses
- Apply Django's middleware and CSRF protection for secure request/response processing
- Manage static assets with Django's staticfiles app and proper project structure
- Implement error handling, logging, and form validation for HTMX requests
Applies to
File patterns this rule matches.
Rule definition (reference)
Source of truth, from the repository.
// HTMX with Django .cursorrules
// HTMX and Django best practices
const htmxDjangoBestPractices = [ "Use Django's template system with HTMX attributes", "Implement Django forms for form handling", "Utilize Django's URL routing system", "Use Django's class-based views for HTMX responses", "Implement Django ORM for database operations", "Utilize Django's middleware for request/response processing", ];
// Folder structure
const folderStructure = project_name/ app_name/ templates/ static/ css/ js/ models.py views.py urls.py project_name/ settings.py urls.py manage.py;
// Additional instructions
const additionalInstructions = `
- Use Django's template tags with HTMX attributes
- Implement proper CSRF protection with Django's built-in features
- Utilize Django's HttpResponse for HTMX-specific responses
- Use Django's form validation for HTMX requests
- Implement proper error handling and logging
- Follow Django's best practices for project structure
- Use Django's staticfiles app for managing static assets `;
Related rules
Senior full-stack TypeScript, React, Node.js guidance with clean architecture, testing, and WHY-oriented reasoning.
Quantitative factor research skills for designing, evaluating, and mining alpha factors in equities markets.
Android development with Jetpack Compose, clean architecture, and Material Design 3.
Angular development with Novo Elements UI library using standalone components.
Expert Angular 18 + TypeScript development with Jest, emphasizing clean code and performance.
Manage Kubernetes clusters, add-ons, stacks, and credentials via the Ankra CLI platform.