home / skills / bankkroll / skills-builder / django

django skill

/skills/django

This skill provides detailed guidance on Django concepts such as auth, class-based views, forms, and database operations.

npx playbooks add skill bankkroll/skills-builder --skill django

Review the files below or copy the command above to add this skill to your agents.

Files (79)
SKILL.md
14.0 KB
---
name: "django"
description: "Scraped from https://docs.djangoproject.com/en/5.0/ Source: https://docs.djangoproject.com/en/5.0/. Use when questions involve: auth, class based views, contrib, contributing, db, deployment."
---

# Django

> Official documentation: https://docs.djangoproject.com/en/5.0/

## Overview

This skill provides comprehensive documentation for django.

**Total references:** 96 files (~586,000 tokens)

**Topics covered:**
Upload Handlers, Documentation helpers, Pickling objects, Templates, Refreshing objects from database, Basic forms, Write your views, TheImageFileclass, Executing custom SQL directly, The basics, Widgets inheriting from theSelectwidget, Test cases features...

## Reference Files

Load only the reference files relevant to the user's question:

### Faq

- **[FAQ: Getting Help¶](references/faq.md)** (~729 tokens)
  - Topics: How do I do X Why doesnt Y work Where can I go to get help, Why hasnt my message appeared ondjango-users, Nobody answered my question What should I do

### General

- **[General Index](references/general-4.md)** (~16,569 tokens)
  - Topics: Symbols

### Howto

- **[How to create custom model fields¶ and more](references/howto-2.md)** (~6,407 tokens)
  - Topics: Introduction, Background theory, Writing a field subclass
- **[How to create custom template tags and filters¶ and more](references/howto-3.md)** (~7,889 tokens)
  - Topics: Code layout, Writing custom template filters, Writing custom template tags
- **[How to deploy with ASGI¶ and more](references/howto-4.md)** (~7,586 tokens)
  - Topics: Theapplicationobject, Configuring the settings module, Applying ASGI middleware
- **[How to create PDF files¶ and more](references/howto-5.md)** (~3,885 tokens)
  - Topics: Install ReportLab, Write your view, Other formats

### Internals

- **[Writing documentation¶ and more](references/internals-1.md)** (~4,330 tokens)
  - Topics: The Django documentation process, Contributing to Django, Work on the Django framework
- **[Django Deprecation Timeline¶](references/internals-2.md)** (~7,217 tokens)
  - Topics: 110
- **[The Django source code repository¶ and more](references/internals-3.md)** (~6,438 tokens)
  - Topics: High-level overview, The main branch, Stable branches
- **[Django’s security policies¶ and more](references/internals-4.md)** (~2,221 tokens)
  - Topics: Reporting security issues, Supported versions, How Django discloses security issues

### Intro

- **[Writing your first contribution for Django¶ and more](references/intro-1.md)** (~7,187 tokens)
  - Topics: Introduction, Code of Conduct, Installing Git
- **[Advanced tutorial: How to write reusable apps¶ and more](references/intro-2.md)** (~4,491 tokens)
  - Topics: Reusability matters, Your project and your reusable app, Installing some prerequisites
- **[Writing your first Django app, part 2¶ and more](references/intro-3.md)** (~7,755 tokens)
  - Topics: Database setup, Creating models, Activating models
- **[Writing your first Django app, part 4¶ and more](references/intro-4.md)** (~7,095 tokens)
  - Topics: Write a minimal form, Use generic views Less code is better, Introducing automated testing
- **[Writing your first Django app, part 6¶ and more](references/intro-5.md)** (~4,492 tokens)
  - Topics: Customize yourappslook and feel, Adding a background-image, Customize the admin form

### Misc

- **[API stability¶ and more](references/misc.md)** (~2,654 tokens)
  - Topics: What stable means, Stable APIs, Exceptions

### Ref

- **[Applications¶ and more](references/ref-1.md)** (~6,696 tokens)
  - Topics: Applications, Application registry, Application configuration
- **[Admin actions¶ and more](references/ref-2.md)** (~3,263 tokens)
  - Topics: Writing actions, Advanced action techniques, Theactiondecorator
- **[The Django admin site¶](references/ref-3.md)** (~19,532 tokens)
  - Topics: Overview, ModelAdminobjects, InlineModelAdminobjects
- **[django.contrib.auth¶ and more](references/ref-4.md)** (~6,938 tokens)
  - Topics: User model, Authentication, Permissions
- **[The flatpages app¶ and more](references/ref-5.md)** (~7,150 tokens)
  - Topics: Installation, How it works, How to add change and delete flatpages
- **[The sitemap framework¶ and more](references/ref-6.md)** (~5,900 tokens)
  - Topics: Overview, Installation, Initialization
- **[Thestaticfilesapp¶ and more](references/ref-7.md)** (~5,840 tokens)
  - Topics: Settings, Management Commands, Storages
- **[Databases¶](references/ref-8.md)** (~7,094 tokens)
  - Topics: General notes, PostgreSQL notes, MariaDB notes
- **[django](references/ref-9.md)** (~12,183 tokens)
  - Topics: Usage, Available commands, Commands provided by applications
- **[Django Exceptions¶ and more](references/ref-10.md)** (~3,776 tokens)
  - Topics: Django Core Exceptions, URL Resolver exceptions, Database Exceptions
- **[The Forms API¶](references/ref-11.md)** (~8,971 tokens)
  - Topics: Bound and unbound forms, Using forms to validate data, Initial form values
- **[Form fields¶](references/ref-12.md)** (~8,264 tokens)
  - Topics: Core field arguments, Checking if the field data has changed, Built-inFieldclasses
- **[Form and field validation¶ and more](references/ref-13.md)** (~7,962 tokens)
  - Topics: RaisingValidationError, Using validation in practice, Specifying widgets
- **[Middleware¶ and more](references/ref-14.md)** (~7,978 tokens)
  - Topics: Middleware, Cache middleware, Common middleware
- **[Model class reference¶ and more](references/ref-15.md)** (~2,039 tokens)
  - Topics: Model class, DoesNotExist, MultipleObjectsReturned
- **[Database Functions¶](references/ref-16.md)** (~8,225 tokens)
  - Topics: Comparison and conversion functions, Date functions, Math Functions
- **[Query Expressions¶](references/ref-17.md)** (~7,871 tokens)
  - Topics: Supported arithmetic, Output field, Some examples
- **[Model field reference¶](references/ref-18.md)** (~14,675 tokens)
  - Topics: Field options, Field types, Relationship fields
- **[Model index reference¶ and more](references/ref-19.md)** (~7,469 tokens)
  - Topics: Indexoptions, Creating objects, Refreshing objects from database
- **[Lookup API reference¶ and more](references/ref-20.md)** (~4,319 tokens)
  - Topics: Registration API, The Query Expression API, Transformreference
- **[QuerySetAPI reference¶](references/ref-21.md)** (~24,893 tokens)
  - Topics: WhenQuerySets are evaluated, QuerySetAPI, Query-related tools
- **[Related objects reference¶ and more](references/ref-22.md)** (~1,749 tokens)
  - Topics: RelatedManager, One-to-many relations, Many-to-many relations
- **[Request and response objects¶](references/ref-23.md)** (~7,608 tokens)
  - Topics: Quick overview, HttpRequestobjects, QueryDictobjects
- **[SchemaEditor¶](references/ref-24.md)** (~1,064 tokens)
  - Topics: Methods, Attributes
- **[Settings¶](references/ref-25.md)** (~17,858 tokens)
- **[TemplateResponse and SimpleTemplateResponse¶ and more](references/ref-26.md)** (~7,957 tokens)
  - Topics: TemplateResponse, SimpleTemplateResponse, Template rendering
- **[Built](references/ref-27.md)** (~14,870 tokens)
  - Topics: Built-in tag reference, Built-in filter reference, Internationalization tags and filters
- **[The Django template language¶ and more](references/ref-28.md)** (~7,905 tokens)
  - Topics: Templates, Variables, Filters
- **[Validators¶ and more](references/ref-29.md)** (~2,900 tokens)
  - Topics: Writing validators, How validators are run, Built-in validators

### Releases

- **[Archive of security issues¶](references/releases.md)** (~4,969 tokens)
  - Topics: Issues under Djangos security process, Issues prior to Djangos security process

### Topics

- **[Asynchronous support¶ and more](references/topics-1.md)** (~2,930 tokens)
  - Topics: Async views, sync_to_async, async_to_sync
- **[Customizing authentication in Django¶](references/topics-2.md)** (~7,200 tokens)
  - Topics: Other authentication sources, Custom permissions, Extending the existingUsermodel
- **[Using the Django authentication system¶](references/topics-3.md)** (~9,773 tokens)
  - Topics: Userobjects, Permissions and Authorization, Authentication in web requests
- **[Password management in Django¶ and more](references/topics-4.md)** (~5,357 tokens)
  - Topics: How Django stores passwords, Manually managing a users password, Password validation
- **[Django’s cache framework¶](references/topics-5.md)** (~9,709 tokens)
  - Topics: Setting up the cache, The per-site cache, The per-view cache
- **[System check framework¶ and more](references/topics-6.md)** (~5,527 tokens)
  - Topics: Writing your own checks, Extending generic views, Generic views of objects
- **[Using mixins with class and more](references/topics-7.md)** (~7,048 tokens)
  - Topics: Context and template responses, Building up Djangos generic class-based views, Using Djangos class-based view mixins
- **[Aggregation¶ and more](references/topics-8.md)** (~6,773 tokens)
  - Topics: Cheat sheet, Generating aggregates over aQuerySet, Generating aggregates for each item in aQuerySet
- **[Models¶](references/topics-9.md)** (~9,705 tokens)
  - Topics: Quick example, Using models, Fields
- **[Multiple databases¶ and more](references/topics-10.md)** (~7,987 tokens)
  - Topics: Defining your databases, Synchronizing your databases, Automatic database routing
- **[Making queries¶](references/topics-11.md)** (~11,274 tokens)
  - Topics: Creating objects, Saving changes to objects, Retrieving objects
- **[Search¶ and more](references/topics-12.md)** (~3,573 tokens)
  - Topics: Use Cases, Performing raw queries, Executing custom SQL directly
- **[Database transactions¶ and more](references/topics-13.md)** (~4,806 tokens)
  - Topics: Managing database transactions, Autocommit, Performing actions after commit
- **[Sending email¶ and more](references/topics-14.md)** (~6,102 tokens)
  - Topics: Quick example, send_mail, send_mass_mail
- **[Formsets¶](references/topics-15.md)** (~5,657 tokens)
  - Topics: Using initial data with a formset, Limiting the maximum number of forms, Limiting the maximum number of instantiated forms
- **[Form Assets (theMediaclass)¶](references/topics-16.md)** (~2,384 tokens)
  - Topics: Assets as a static definition, Mediaas a dynamic property, Paths in asset definitions
- **[Creating forms from models¶](references/topics-17.md)** (~7,566 tokens)
  - Topics: ModelForm, Model formsets, Inline formsets
- **[Working with forms¶ and more](references/topics-18.md)** (~6,776 tokens)
  - Topics: HTML forms, Djangos role in forms, Forms in Django
- **[File Uploads¶ and more](references/topics-19.md)** (~4,994 tokens)
  - Topics: Basic file uploads, Upload Handlers, Writing your own middleware
- **[How to use sessions¶ and more](references/topics-20.md)** (~6,273 tokens)
  - Topics: Enabling sessions, Configuring the session engine, Using sessions in views
- **[URL dispatcher¶ and more](references/topics-21.md)** (~7,021 tokens)
  - Topics: Overview, How Django processes a request, Example
- **[Format localization¶ and more](references/topics-22.md)** (~5,378 tokens)
  - Topics: Overview, Locale aware input in forms, Controlling localization in templates
- **[Translation¶](references/topics-23.md)** (~12,407 tokens)
  - Topics: Overview, Internationalization in Python code, Internationalization in template code
- **[Internationalization and localization¶ and more](references/topics-24.md)** (~3,490 tokens)
  - Topics: Overview, Definitions, Internationalization
- **[Migrations¶ and more](references/topics-25.md)** (~7,984 tokens)
  - Topics: The Commands, Backend Support, Workflow
- **[Performance and optimization¶ and more](references/topics-26.md)** (~5,886 tokens)
  - Topics: Introduction, General approaches, Caching
- **[Serializing Django objects¶ and more](references/topics-27.md)** (~7,615 tokens)
  - Topics: Serializing data, Deserializing data, Serialization formats
- **[Cryptographic signing¶ and more](references/topics-28.md)** (~5,302 tokens)
  - Topics: Protecting SECRET_KEY, Using the low-level API, Signing values
- **[Advanced testing topics¶](references/topics-29.md)** (~5,248 tokens)
  - Topics: The request factory, Testing class-based views, Tests and multiple host names
- **[Writing and running tests¶](references/topics-30.md)** (~2,758 tokens)
  - Topics: Writing tests, Running tests
- **[Testing tools¶](references/topics-31.md)** (~13,074 tokens)
  - Topics: The test client, Provided test case classes, Test cases features
- **[Testing in Django¶](references/topics-32.md)** (~565 tokens)
  - Topics: Testing overview, Test suite, unittest

## Usage Guidelines

1. **Identify relevant sections** - Match the user's question to the appropriate reference file(s)
2. **Load minimally** - Only read files directly relevant to the question to conserve context
3. **Cite sources** - Reference specific sections when answering
4. **Combine knowledge** - For complex questions, you may need multiple reference files

### When to use each reference:

- **Auth**: Auth-related features and documentation
- **Class Based Views**: Class Based Views-related features and documentation
- **Contrib**: Contrib-related features and documentation
- **Contributing**: Contributing-related features and documentation
- **Db**: Db-related features and documentation
- **Deployment**: Deployment, hosting, and infrastructure
- **Faq**: Faq-related features and documentation
- **Files**: Files-related features and documentation
- **Forms**: Forms-related features and documentation
- **General**: General documentation, overview, and getting started
- **Howto**: Howto-related features and documentation
- **Http**: Http-related features and documentation
- **I18N**: I18N-related features and documentation
- **Internals**: Internals-related features and documentation
- **Intro**: Intro-related features and documentation
- **Misc**: Misc-related features and documentation
- **Models**: Models-related features and documentation
- **Ref**: Ref-related features and documentation
- **Releases**: Releases-related features and documentation
- **Templates**: Templates-related features and documentation
- **Testing**: Testing-related features and documentation
- **Topics**: Topics-related features and documentation

Overview

This skill provides concise, practical guidance from the Django 5.0 documentation for building, configuring, and deploying Django applications. It focuses on core areas including authentication, class-based views, contrib apps, database usage, and deployment patterns. Use it to get authoritative, implementation-focused answers and examples for common Django tasks.

How this skill works

The skill inspects the official Django 5.0 docs split into targeted sections (Intro, Howto, Reference, Topics, Internals, and Releases). When you ask a question, it matches your intent to the relevant documentation files (auth, class-based views, db, contrib, deployment, etc.) and returns distilled, actionable guidance. It emphasizes code-level details, configuration options, and recommended workflows for real-world Django development.

When to use it

  • You need concrete guidance on authentication flows, permissions, or custom user models.
  • You’re implementing or debugging class-based views, generic views, or view mixins.
  • You need reference-level details about contrib apps like admin, auth, staticfiles, sitemaps, or flatpages.
  • You’re designing database models, queries, transactions, or working with multiple databases.
  • You’re preparing a Django app for deployment (ASGI/WSGI configuration, static/media handling, security settings).
  • You want practical how‑to steps: custom fields, template tags/filters, file uploads, or writing reusable apps.

Best practices

  • Prefer Django’s built-in auth and permission tools; extend the User model only when necessary and follow recommended migration patterns.
  • Use generic class-based views and mixins to reduce boilerplate, and override only required hooks (get_context_data, form_valid, etc.).
  • Keep settings modular: separate secret/config per environment and use Django’s settings patterns for static/media and caching.
  • Write database queries with QuerySet APIs and aggregation tools first; use raw SQL only when necessary and wrap it with proper transactions.
  • Follow Django’s testing patterns: use provided test case classes, the test client, and test for multiple host names and async behavior where applicable.

Example use cases

  • Add a custom permission and enforce it in both views and the admin site.
  • Implement a CreateView with form handling, success URL logic, and optimized queryset usage.
  • Configure ASGI deployment with proper application and middleware ordering for async support.
  • Create a custom model field or a template filter and register it for reuse across apps.
  • Migrate a multi-database setup and implement routing rules for reads and writes.

FAQ

Which docs section should I consult for authentication changes?

See the Using the Django authentication system and Customizing authentication sections for user model, permissions, and password management guidance.

When should I use class-based views vs function views?

Use class-based generic views to reduce boilerplate for common patterns (CRUD, lists, detail views); prefer function views for tiny, highly specific endpoints or when explicit control is required.