python-django
Django architecture, ORM select_related/prefetch_related optimization, middleware, and signals discipline.
SKILL.mdskills/python-django/SKILL.md
GitHubDjango Architecture Protocol
Build maintainable Django and Django REST Framework services.
1. Query Optimization
- Always use
select_relatedfor single-valued relationships (ForeignKey, OneToOne). - Always use
prefetch_relatedfor multi-valued relationships (ManyToMany, reverse FK) to eradicate N+1 queries.
2. Fat Models, Thin Views
Place business logic and invariants in model methods or domain services, never in views or serializers.