# Django

> Django Python web framework. Use when building Django projects, ORM queries, admin interface customization, class-based views, DRF APIs, or using signals and middleware. Use when this capability is needed.

- Skill: `tomevault-io/django-10` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/django-10`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/django-10/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/django-10

---


## django

High-level Python framework with batteries included for rapid, secure web development.

### Core Concepts
- ORM: queryset API with lazy evaluation, `select_related`/`prefetch_related` for N+1 prevention
- Admin interface: auto-generated CRUD from models, customizable via `ModelAdmin` classes
- Class-based views: `ListView`, `DetailView`, `CreateView` reduce boilerplate over function views
- DRF: `ModelViewSet` + `Serializer` classes for RESTful APIs with browsable docs

### Common Patterns
- Signals: `post_save`/`pre_delete` for decoupled side effects like cache invalidation
- Middleware: request/response pipeline for auth, CORS, logging, or rate limiting
- Auth system: built-in `User` model, permissions, groups, and session-based authentication
- Testing: `TestCase` with `Client` for request simulation, `assertContains` for template checks

### Best Practices
- Use `select_related` for FK relationships and `prefetch_related` for M2M to avoid N+1 queries
- Keep business logic in model methods or service layers, not in views or signals
- Apply database-level constraints (unique, FK) alongside model-level validation
- Use `@login_required` and `@permission_required` decorators rather than manual checks

### Common Code Patterns
- `class ArticleView(DetailView): model = Article; template_name = "article.html"`
- `@api_view(["GET"])` with `@permission_classes([IsAuthenticated])` for DRF endpoints

---
> Source: [skeletorflet/opencode-supreme-setup](https://github.com/skeletorflet/opencode-supreme-setup) — distributed by [TomeVault](https://tomevault.io).
<!-- tomevault:4.0:skill_md:2026-06-15 -->

