top band

Thursday 1:20 p.m.–4:40 p.m.

Django in Depth

James Bennett

Audience level:
Web Frameworks


This is a tutorial that goes beyond most tutorials; it's meant for developers who already know a bit about Django and want to really understand the inner guts of the framework. This tutorial will *not* involve writing code or apps; rather, it'll be a deep tour of the workings and APIs of Django itself, across all the bundled components and at all levels of the stack.


This tutorial will proceed through each of Django's major components in order, finishing with the administrative interface as an example of how all those components can be tired together. We'll begin with a deep dive into the Django ORM; this will work from the bottom up, showing how Django turns a simple ORM method call into a database query and a set of results. Starting from the level of the database driver, we'll come back up the chain through the Query and QuerySet classes back into the everyday realm of Manager and Model, noting points of flexibility/customization along the way, and useful common patterns and advice for use in real applications. Next we'll turn to the forms library, covering the implementation from Form and Field down into Widget and the full validation process, including all of the customization hooks, before looking at ModelForm and direct model integration and easy methods for generating dynamic custom forms on the fly in application code. From there we'll look at the template language, inside and out, covering all the details of how templates are parsed, compiled and rendered, and a full explanation of how template tags work and of patterns for writing custom tags. Next up is Django's request/response processing pipeline, covering the handler behavior, request and response objects, the middleware system and how Django's URL resolution works and gets to the actual view to call. Following up on that we'll take a look at just what a Django view is, starting with function-based views and then working toward an understanding of class-based views as exemplified by Django's built-in generic views. Finally we'll put it all together with a look at the Django administrative interface, seeing how all the components work together and how the AdminSite and ModelAdmin classes actually work and can be customized.

Student Handout

No handouts have been provided yet for this tutorial

bottom band background