Django Internals
How Django works, read from its source: what each part owns, when it runs, and why it is built the way it is.
Django main at 4fab678 (2026-09-26), on its way to 6.2
Django’s documentation says how to use Django, and says it well. This book is about the other thing: how the framework itself works. It follows a request from the server’s call to the response, a model from its class statement to the SQL it produces, a template from text to output, and at each step it says which object is responsible, when that object runs, and what it hands to the next.
It is written for people who need a working model of the system, whether to debug it, to extend it, or to direct an agent that is doing either, and for the agents themselves. Every class, function and setting named here exists in Django’s source at the commit the book describes, and every passage names the code it is about, so a reader can go and look.
Contents
-
Django is a web framework written in Python: the code between a web server and a web application, which turns each HTTP request the server hands it into a response, keeps the application’s data as models over a relational database, and draws its pages from templates. This chapter is the map of it: the objects that carry it, how its parts lean on one another, how it is extended, and where it stops.
Part I · The request cycle
-
One HTTP request followed from the server’s call to the last byte of the response, through the handler and its middleware, the URL resolver, the view, the ORM from queryset to SQL, the template engine, and the response.
-
Startup makes a Python process a configured Django.
djangoloads the module that.conf .settings "DJANGO_SETTINGS_MODULE"names at the first read or write of a setting, anddjango.setuppopulates the app registry,django.apps.apps: anAppConfigfor each entry ofsettings, and every application’s models imported. Until that call the registry refuses most questions, with.INSTALLED_APPS AppRegistryNotReadywhere settings can be read. -
The handler, a
WSGIHandleror anASGIHandler, is ordinarily the object a web server calls for each request. It builds the middleware chain fromsettingswhen it is made, and sends each request it makes into that chain, at whose centre stands the view..MIDDLEWARE -
HttpRequestis the object a view is given andHttpResponsethe object it returns. The handler makes aWSGIRequestor anASGIRequestfrom what the server passed, at almost no cost, and each of the request’s collections is parsed the first time something reads it:GET,COOKIES,headers, and, from the body,POSTandFILES. A response, anHttpResponseor aStreamingHttpResponse, is a status, headers, cookies and a body, which the handler hands to the server.- 5.1 Making the request:
WSGIRequestandASGIRequest - 5.2 Headers, host and scheme
- 5.3
QueryDict - 5.4 The body:
body,POSTandFILES - 5.5 Multipart parsing:
MultiPartParser - 5.6 Upload handlers and uploaded files
- 5.7 The response object
- 5.8 Streaming and file responses
- 5.9 Cookies
- 5.10 The helpers in
django/utils/ http .py
- 5.1 Making the request:
-
The URL resolver answers two questions from one description of a site’s addresses: which view serves this path, and which path leads to this view. The URLconf that
ROOT_URLCONFnames is made, by its calls ofpathandinclude, into a tree ofURLResolverobjects and the patterns under them;URLResolverwalks the tree to turn a path into a.resolve ResolverMatch, or raisesResolver404, andreverseturns a pattern’s name and arguments back into a path.- 6.1 From a URLconf to a tree
- 6.2 When a URLconf is imported
- 6.3 Routes, regular expressions and converters
- 6.4 Resolving a path
- 6.5 Reversing a name
- 6.6
normalize, and the patterns that cannot be reversed - 6.7 Namespaces
- 6.8 Language prefixes and translated routes
- 6.9 The URL checks, and listing the patterns
- 6.10 The script prefix, the current URLconf and the caches
-
A view is the callable the URL resolver found for a request’s path: the handler calls it with the request and the arguments the resolver found for it, and it returns a response or raises an exception.
View.as_viewmakes a class into a view and decorators such asnever_cachewrap one; the generic views are view classes of Django’s own, and the error views and debug pages are Django’s answers to an exception raised inside the middleware chain.- 7.1 What the handler asks of a view
- 7.2
View.as_viewand dispatch - 7.3 View decorators
- 7.4 Decorating a class:
method_decorator - 7.5 A middleware as a decorator
- 7.6 Asynchronous views
- 7.7 The shortcuts
- 7.8 The generic views
- 7.9
DetailViewandListView - 7.10 The form views
- 7.11 The date views: a date, an interval and its neighbours
- 7.12 The seven date views
- 7.13 The error views
- 7.14 The debug pages and
ExceptionReporter - 7.15 What an error report hides
- 7.16 The static file view
-
Django’s security machinery includes four middleware and two small libraries.
CsrfViewMiddlewareordinarily refuses a request that may change something, such as a"POST", unless it comes from the site’s own pages and carries a CSRF token from them;SecurityMiddleware,XFrameOptionsMiddlewareandContentSecurityPolicyMiddlewareadd headers that tell the browser what to refuse; anddjangoand.utils .crypto djangomake, from.core .signing SECRET_KEY, the keyed hashes with which Django signs what it hands out. System checks tagged"security"look over many settings.- 8.1 The CSRF secret and its token
- 8.2 The CSRF check:
CsrfViewMiddleware.process_view - 8.3 The security headers:
SecurityMiddlewareandXFrameOptionsMiddleware - 8.4 Content Security Policy and the nonce
- 8.5 Secret keys and
django.utils .crypto - 8.6 Signing:
Signer,TimestampSigner,dumpsandloads - 8.7 The security checks
Part II · The ORM
-
A model class is put together while its class statement runs. A metaclass,
ModelBase, hands the new class to every field in the body; each field enters itself in the class’s options object and leaves a descriptor where it stood; and a relation can put an attribute on the class it points at as well. -
An instance of a model stands for one row: it holds the row’s values in its
__dict__under the fields’ attnames, with a state that says where it came from; it can fetch what it lacks when it is read, writes itself back table by table when it is saved, and is collected, ordinarily with what depends on it, before it is deleted. -
A
QuerySetis a query that has been described and not yet run, and afterwards the rows it brought back. A method that refines it ordinarily returns a clone; the first time it is iterated, or asked its length or its truth, it sends its statement and keeps what comes back in a result cache; and an iterable class decides what each row becomes: a model instance, a dictionary, a tuple or a single value.- 11.1 Clones: how a queryset is built
- 11.2
filter,excludeandQobjects - 11.3 Annotations, ordering and the other methods that change the query
- 11.4 Combining querysets: the operators and
union - 11.5 Evaluation and the result cache
- 11.6 From rows to instances:
ModelIterable - 11.7
valuesandvalues_list: rows as dictionaries and tuples - 11.8 Deferred fields in a queryset:
deferandonly - 11.9
get,first,countand the other methods that run a query at once - 11.10 Creating, updating and deleting through a queryset
- 11.11
bulk_createandbulk_update - 11.12 Raw querysets
- 11.13 The asynchronous methods of a queryset
-
A relation is one fact written in one class and needed in two: a
ForeignKey, aOneToOneFieldor aManyToManyFieldon one model, and its rel, the same relation seen from the other. Each end ordinarily leaves an attribute on its class, and the related objects read through them may be kept in caches on the instance, filled by assignment, by a read, by a join in the same row or by a second statement. -
13 Expressions, lookups and functions
The objects of a query that write their own SQL: an expression is bound to a query by
resolve_expressionand written byas_sql; a lookup is a comparison, found by its name in a registry, prepared when the filter is built and written when the query is compiled; a function fills a template; and the where tree joins them, counting the children that match nothing or everything.- 13.1 The lookup registry:
RegisterLookupMixin - 13.2 Expressions:
resolve_expressionandas_sql - 13.3 Lookups:
Lookup,BuiltinLookupand the standard comparisons - 13.4 Transforms and database functions:
TransformandFunc - 13.5 Lookups on relations and composite keys:
RelatedInand the tuple lookups - 13.6 Aggregates:
AggregateandCount - 13.7 Window expressions:
WindowandWindowFrame - 13.8 What the where tree writes:
WhereNode
- 13.1 The lookup registry:
-
A
Queryis the description of a statement that a queryset’s methods write and a compiler later reads: a filter’s names are walked through the models to joins in an alias map, the words left over become lookups in a where tree, and the conditions vote together on which joins are inner and which outer.- 14.1 The query: what a
Queryholds, and how it is copied - 14.2 From a name to a column:
names_to_path,setup_joinsandbuild_lookup - 14.3 Tables and joins: the alias map and join promotion
- 14.4 The where clause:
add_qandbuild_filter - 14.5 Subqueries:
Subquery,Exists,OuterRefand a query inside another - 14.6 Merging two queries:
Query.combine
- 14.1 The query: what a
-
A
SQLCompilerturns a query into one string of SQL with its parameters, sends it, and hands the rows back with their converters applied. It settles the clauses in the order they depend on one another and writes them in the order SQL wants, and where one"SELECT"cannot say what a queryset asks, it writes more than one, side by side or one inside another.- 15.1 The compiler:
as_sql,execute_sqlandresults_iter - 15.2 The SELECT clause:
get_select, the select mask andklass_info - 15.3 ORDER BY and DISTINCT:
get_order_by,find_ordering_nameandget_distinct - 15.4 GROUP BY and HAVING:
set_group_by,get_group_byandsplit_having_qualify - 15.5 Aggregating a query:
Query.get_aggregation - 15.6 The QUALIFY rewrite: a filter on a window
- 15.7 Compound statements:
get_combinator_sql - 15.8 INSERT, UPDATE and DELETE: the insert, update and delete compilers
- 15.1 The compiler:
Part III · The database
-
16 Connections and transactions
Django holds a database as a connection object for each alias of
DATABASESin each thread, opened when it is first needed and kept or closed at each request’s end; the statements of the compiler and of the schema editor pass through Django’s cursor, and under autocommit every write is its own transaction unless an atomic block makes it part of one.- 16.1 Connections by alias:
DATABASESandConnectionHandler - 16.2 Opening and closing a connection
- 16.3 Cursors: executing a statement, the query log and execute wrappers
- 16.4 Transactions: autocommit,
atomicand savepoints - 16.5 Work held until the commit:
on_commit - 16.6 Routing between databases:
ConnectionRouter
- 16.1 Connections by alias:
-
A backend is the package that stands between the ORM and one kind of database. Its class of connection, built on
BaseDatabaseWrapper, and the objects that connection carries say what the database can do, what SQL it writes, how a value crosses into it and back, and how its schema is read and changed; what differs between databases is decided in a few places, the same on every backend, and SQLite, PostgreSQL, MySQL and Oracle each depart from the plain case there.- 17.1 The connection object:
BaseDatabaseWrapperand what a backend provides - 17.2 What a database can do:
BaseDatabaseFeatures - 17.3 The SQL a backend writes:
BaseDatabaseOperations - 17.4 Column types: from a field to a column
- 17.5 Values in and out: adapters, converters and time zones
- 17.6 Inserts: returned keys, conflicts and batch sizes
- 17.7 SQLite
- 17.8 PostgreSQL
- 17.9 MySQL and MariaDB
- 17.10 Oracle
- 17.1 The connection object:
-
Django changes a database’s structure from the models: a schema editor writes the DDL for one database and sends it, holding some statements, ordinarily until it is left; introspection reads the structure back where the models cannot answer; and for tests a whole database is made, in which migrate builds the models’ tables and the flush can empty them.
-
Migrations are how a change to a model becomes a change to a database. A migration file lists operations; makemigrations writes such files by comparing the models with what the existing files already describe, and migrate applies them to a database in the order their dependencies allow, recording each one there in the table
"django_migrations".- 19.1 A migration: its operations, its dependencies and how it is applied
- 19.2 Operations: the base class and its two halves
- 19.3 Project state:
ProjectStateand its model states - 19.4 Historical models:
StateAppsand rendering - 19.5 The model operations:
CreateModel,DeleteModel,RenameModeland the option operations - 19.6 The field operations, and those on indexes and constraints
- 19.7
RunPython,RunSQLandSeparateDatabaseAndState - 19.8 What has been applied:
MigrationRecorderand the table"django_migrations" - 19.9 The migration graph:
MigrationGraph - 19.10 Finding migrations:
MigrationLoader - 19.11 Applying a plan:
MigrationExecutor - 19.12 The migrate command, showmigrations and sqlmigrate
- 19.13 Replacing migrations:
replaces
-
makemigrations compares two descriptions of the models, the one the migrations on disk add up to and the one the code gives now, and writes the difference as migrations: the autodetector finds the operations, orders them and cuts them into migrations, the optimizer folds them, and the writer turns each into the text of a file.
- 20.1 The autodetector: comparing two project states
- 20.2 The autodetector: fields, indexes and constraints
- 20.3 The questioner:
MigrationQuestioner - 20.4 From operations to migrations: dependencies, order and names
- 20.5 The optimizer:
MigrationOptimizerandreduce - 20.6 Serializing values:
serializer_factoryanddeconstruct - 20.7 Writing a migration file:
MigrationWriter - 20.8 The makemigrations command
- 20.9 Rewriting migrations:
--update, squashmigrations and optimizemigration
Part IV · Templates, forms and services
-
Django’s template system turns the name of a template and a dictionary of values into a string. It compiles a template’s text into a tree of nodes, by default once, and renders the tree against a fresh context each time it is asked, escaping for HTML as it goes. Around that language sits a thin layer of pluggable template engines, configured by
TEMPLATES, through which a view asks for a template by name.- 21.1 Template engines:
TEMPLATESand the backends - 21.2 Finding a template:
Engineand the loaders - 21.3 From text to nodes: the lexer and the parser
- 21.4 Variables and filters:
FilterExpressionandVariable - 21.5 The context:
Context,RequestContextand context processors - 21.6 Rendering: nodes and the render context
- 21.7 Autoescaping and safe strings
- 21.8 Inheritance and inclusion:
{% extends %},{% block %}and{% include %} - 21.9 Template partials:
{% partialdef %}and{% partial %} - 21.10 Libraries:
Library, custom tags and{% load %} - 21.11 The built-in tags
- 21.12 The built-in filters
- 21.13 The libraries to load: static, i18n, l10n, tz and cache
- 21.14
SimpleTemplateResponseandTemplateResponse - 21.15 Template errors and debug information
- 21.1 Template engines:
-
Django’s forms turn the strings a browser submits into checked Python values, and values back into HTML inputs. A form class declares its fields; each instance copies them and, bound to submitted data, cleans each value through the field’s widget, the field and its validators before the form’s own checks run. Formsets repeat one form over many rows, and a model form makes its fields from a model’s and writes what it cleaned back onto an instance.
- 22.1 Declaring a form:
DeclarativeFieldsMetaclassandBaseForm - 22.2 A form field: the base class
- 22.3 Validation:
full_clean,cleaned_dataand the errors - 22.4 Validators:
django/core/ validators .py - 22.5 The built-in form fields
- 22.6 Widgets:
Widgetand its subclasses - 22.7 Choices:
ChoiceField,ModelChoiceFieldand the choice widgets - 22.8
BoundField: a field in a form - 22.9 Rendering a form: renderers and templates
- 22.10 Form assets:
Media - 22.11 Formsets:
BaseFormSetand the management form - 22.12 Model forms:
ModelFormandfields_for_model - 22.13 Model formsets and inline formsets
- 22.1 Declaring a form:
-
23 Internationalization and time zones
Django serves each request in a language and a time zone of its own, from code and templates written once: a message marked for translation is looked up as it is used, in the translations of the active language; numbers and dates are written in that language’s formats; and a datetime, stored as an instant, is shown in the current time zone.
django,.utils .translation djangoand.utils .formats djangodo the three, and.utils .timezone LocaleMiddlewarechooses each request’s language.- 23.1 Translating a message
- 23.2 Message catalogues:
DjangoTranslation - 23.3 The active language
- 23.4 Lazy translations
- 23.5 Choosing a language:
LocaleMiddleware - 23.6 The language views:
set_languageandJavaScriptCatalog - 23.7 Locale formats:
get_formatand the format modules - 23.8 Writing numbers, dates and durations
- 23.9 Time zones
- 23.10 Making catalogues: makemessages and compilemessages
-
24 Caching, files, mail, signals and tasks
The services that code all over Django, and a project’s own, calls into: the signal dispatcher, by which one part of the code hears of another’s events; the cache framework; file storage; email; background tasks; and the serializers and the paginator. Four of them share one shape: a setting of backends named by alias, a handler that makes a backend when it is asked for one, and a base class that every backend implements.
- 24.1 Signals:
Signal, receivers and sending - 24.2 The signals Django sends
- 24.3 The cache API:
cachesandBaseCache - 24.4 The cache backends
- 24.5 The page cache:
UpdateCacheMiddleware,FetchFromCacheMiddlewareandcache_page - 24.6 Cache headers and conditional requests:
django/utils/ cache .py - 24.7 Files:
File,ContentFileand their helpers - 24.8 File storage:
Storage,FileSystemStorageandstorages - 24.9 Email messages:
EmailMessageandEmailMultiAlternatives - 24.10 Sending email:
mailersand the email backends - 24.11 Background tasks:
Task,TaskResultand the task backends - 24.12 Serialization:
serialize,deserializeandDeserializedObject - 24.13 Fixtures: dumpdata and loaddata
- 24.14 Pagination:
PaginatorandPage
- 24.1 Signals:
-
The modules of
django/utils/that serve every part of Django and belong to none, withdjango: the lazy values, lazy objects and cached properties by which code puts off work until it is needed, the importing of code named by a dotted path, the data structures and the helpers for text, values and paths that the request cycle and the ORM share, the exceptions they raise, and the tools with which Django deprecates its own API and names its versions..core .exceptions - 25.1 Lazy values:
lazy,Promiseandkeep_lazy - 25.2 Lazy objects:
LazyObjectandSimpleLazyObject - 25.3
cached_property,classpropertyandclassonlymethod - 25.4 Importing by name:
import_stringandautodiscover_modules - 25.5 Asking a callable what it accepts:
django/utils/ inspect .py - 25.6 Data structures:
MultiValueDictand its neighbours - 25.7 Choices:
normalize_choicesand the choice iterators - 25.8 Text and bytes:
django/utils/ encoding .py - 25.9 Text helpers:
Truncatoranddjango/utils/ text .py - 25.10 Dates, durations and addresses:
parse_datetime,parse_durationandclean_ipv6_address - 25.11 Paths and archives:
safe_join,safe_makedirsandextract - 25.12 Django’s exceptions:
django.core .exceptions - 25.13 Deprecation: warnings named by year,
warn_about_external_useanddeprecate_posargs - 25.14 Django’s version:
VersionTupleandget_version
- 25.1 Lazy values:
Part V · Applications and tools
-
26 Authentication, sessions and messages
Three applications of
django.contribgive a site the memory that HTTP lacks.djangokeeps a dictionary for each browser from one request to the next;.contrib .sessions djangokeeps in that dictionary which user the browser belongs to, and checks passwords and permissions;.contrib .auth djangokeeps a note written while one request is answered until a later page shows it..contrib .messages - 26.1 The session store:
SessionBase - 26.2
SessionMiddleware: the cookie and the save - 26.3 The session backends
- 26.4 The user model:
AbstractBaseUser,UserandAUTH_USER_MODEL - 26.5 Password hashing:
make_passwordand the hashers - 26.6 Password validation:
validate_passwordand the validators - 26.7 Authenticating:
authenticateand the backends - 26.8 The user of a request:
login,logoutandAuthenticationMiddleware - 26.9 Permissions:
Permission, groups andhas_perm - 26.10 Making the permissions:
create_permissions - 26.11 Requiring a login:
login_required,permission_requiredandLoginRequiredMiddleware - 26.12 The authentication forms:
AuthenticationFormand the password forms - 26.13 The login and password views:
LoginView,LogoutViewandPasswordChangeView - 26.14 Password reset:
PasswordResetTokenGeneratorand the reset views - 26.15 Creating a superuser: createsuperuser and changepassword
- 26.16 Messages:
add_message,MessageandMessageMiddleware - 26.17 Message storage:
CookieStorage,SessionStorageandFallbackStorage
- 26.1 The session store:
-
djangobuilds a working site for editing a project’s rows out of the models themselves. An.contrib .admin AdminSitekeeps aModelAdminfor each model registered with it and turns them into a URLconf; eachModelAdminserves its model’s list, add, change, delete and history pages, built from the model’s_metaand the model admin’s options, and asks the user’s permissions before each.- 27.1 Registering models:
AdminSiteand.register ModelAdmin - 27.2 The admin’s URLs:
AdminSiteand.get_urls AdminSite.admin_view - 27.3 The site’s own pages: the index, the login and
AdminSite.each_context - 27.4 Permissions in the admin:
has_change_permissionand the others - 27.5 The change form:
changeform_view - 27.6 The admin’s forms:
get_formandformfield_for_dbfield - 27.7 The admin’s widgets: related objects, raw ids and autocomplete
- 27.8 Inlines:
InlineModelAdminand its formsets - 27.9 The change list:
changelist_viewandChangeList - 27.10 The change list’s columns:
list_displayandlist_editable - 27.11 Filters and search:
list_filter,search_fieldsanddate_hierarchy - 27.12 Actions:
response_actionanddelete_selected - 27.13 Deleting:
delete_viewandget_deleted_objects - 27.14 The log and the history:
LogEntryandhistory_view - 27.15 The admin’s templates and media
- 27.16 The admin’s checks:
check_dependenciesandModelAdminChecks - 27.17 The documentation generator:
django.contrib .admindocs
- 27.1 Registering models:
-
28 Content types, static files and the other contrib apps
The applications of
django.contribthat are not authentication, sessions, messages or the admin: content types, which give the models rows of their own so that a row can point at any model; sites, which keep a row for each domain a project serves; static files, which find, collect, name and serve a project’s CSS, JavaScript and images; flat pages, redirects, sitemaps, feeds and humanize, small applications, most of them built on those; and the PostgreSQL and GIS extensions to the ORM.- 28.1 Content types:
ContentTypeand its cache - 28.2 Making content types:
create_contenttypesandRenameContentType - 28.3 Generic foreign keys:
GenericForeignKey - 28.4 Generic relations:
GenericRelationand generic inlines - 28.5 Sites:
Site,get_current_siteand theshortcutview - 28.6 Finding static files: the finders
- 28.7 Collecting static files: the collectstatic command
- 28.8 Static file storages:
ManifestStaticFilesStorageand hashed names - 28.9 Serving static files:
StaticFilesHandlerand the development server - 28.10 Flat pages and redirects: the fallback middleware
- 28.11 Sitemaps:
Sitemapand the sitemap views - 28.12 Feeds:
djangoand the feed generator.contrib .syndication - 28.13 Humanize:
naturaltime,intcommaand the other filters - 28.14 The PostgreSQL application:
PostgresConfig, operations and aggregates - 28.15 PostgreSQL fields:
ArrayField, the range fields and hstore - 28.16 Full-text search:
SearchVector,SearchQueryandSearchRank - 28.17 PostgreSQL indexes and
ExclusionConstraint - 28.18 Geometries in Python: GEOS and GDAL
- 28.19 Spatial fields: the geometry fields and
RasterField - 28.20 Spatial backends: PostGIS, SpatiaLite, MySQL and Oracle
- 28.21 Spatial lookups, functions and distances
- 28.22 GeoDjango’s forms, admin, feeds and data tools
- 28.1 Content types:
-
What happens between a command line such as
python manageand the code that does the work:.py migrate ManagementUtilityfinds the command’s class, andBaseCommandparses the arguments, runs the system checks and calls the command’shandle. The development server is one such command, and its reloader runs it as two processes. -
django.testruns a project’s tests, written asunittesttest cases, against the project itself. The test command hands them to a runner, by defaultDiscoverRunner, which finds them, makes a test database for each database they use and runs them; the test case classesSimpleTestCase,TransactionTestCaseandTestCasekeep each test from seeing what another wrote to the database; and theClientsends requests through the project’s middleware and views with no server.- 30.1 The runner: the test command and
DiscoverRunner - 30.2 Finding and ordering the tests:
DiscoverRunner.build_suite - 30.3 The test environment:
setup_test_environment - 30.4 Which databases a test uses:
databases - 30.5 One test, in order:
SimpleTestCase - 30.6 Emptying the tables after each test:
TransactionTestCase - 30.7 A transaction around each test:
TestCase - 30.8 Settings for one test:
override_settingsandTestContextDecorator - 30.9 Building a request:
RequestFactory - 30.10 The test client:
ClientandClientHandler - 30.11 Sessions and logins in the test client:
ClientMixinand.login force_login - 30.12 Assertions on a response:
assertContains,assertRedirectsandassertTemplateUsed - 30.13 Comparing HTML, XML and JSON:
assertHTMLEqualandparse_html - 30.14 Counting queries:
assertNumQueriesandCaptureQueriesContext - 30.15 A server in a thread:
LiveServerTestCase - 30.16 Running in parallel:
ParallelTestSuite
- 30.1 The runner: the test command and
-
How Django became what it is, from the framework released out of a newsroom in 2005 to this commit, and what a reader who learnt an earlier release must update: the changes from Django 5.0 on, where each now lives in the source, and the old uses the code keeps working until a coming release removes them.
- 31.1 The first decade: from a newsroom to 1.8
- 31.2 The second decade: from 1.9 to 5.0
- 31.3 What changed in settings, startup and the commands
- 31.4 What changed in handlers, requests, URLs and views
- 31.5 What changed in models and fields
- 31.6 What changed in querysets
- 31.7 What changed in expressions, lookups and the compiler
- 31.8 What changed in the database backends and migrations
- 31.9 What changed in templates
- 31.10 What changed in forms and validators
- 31.11 What changed in security: Content Security Policy and signing
- 31.12 What changed in time zones, translation and the utilities
- 31.13 What changed in mail and tasks
- 31.14 What changed in caching, files, signals, serialization and pagination
- 31.15 What changed in authentication, sessions and messages
- 31.16 What changed in the admin
- 31.17 What changed in the other contrib apps
- 31.18 What changed in GeoDjango
- 31.19 What changed in the test framework
- 31.20 Security fixes: SQL injection
- 31.21 Security fixes: disclosure, spoofing and privilege
- 31.22 Security fixes: limits against denial of service
- 31.23 The versions Django needs: Python, databases and libraries
- 31.24 What still warns: the deprecations and the releases that end them