OE1-5.4 Django
Standard web platform behaviour and the frameworks named in the course outline — written September 2026
What this is and why it exists
This is the first server-side framework in the course, and its shape is the same principle from the first topic applied to a whole application.
Data, presentation and routing are kept in separate places. That separation is why a project built this way is still navigable when it is large.
The vocabulary
- Model — a description of your data, written once, from which the database structure is derived.
- Template — the presentation layer, deliberately limited so that logic stays out of it.
- URL configuration — the mapping from addresses to the code that handles them.
- Migration — a recorded change to the database structure, derived from a change to a model.
- Template inheritance — one template extending another, so shared structure is written once.
- Validation — checking that submitted input has the form and content you require.
- Server-side — running on the server rather than in the browser.
The mental model
The three parts and their boundaries are what to learn first.
The model layer describes your data as classes in code. That description is written once. The framework derives the database structure from it and generates an administrative interface. It also records each change, so an existing database can be brought up to date.
That is where most of the design effort in such an application actually goes, and it is worth spending. Getting the data right early is cheap. Changing it after data exists means migrating that data, and every part of the application that assumed the old shape.
Templates are the presentation layer, and their limitation is deliberate. They are not a general programming language. You can insert values and repeat over a collection and choose between alternatives, and you cannot do arbitrary computation. That restriction takes getting used to and it is a feature. It forces the thinking into the code layer, where it can be tested. It also keeps the presentation readable by someone who is not a programmer.
Template inheritance is what makes the layer maintainable. A base template holds the shared structure of the site and marks the regions that vary. Each page extends it and fills those regions. Without it, a change to the navigation means editing every page, which is the difference between a maintainable site and a copied one.
The address configuration maps incoming addresses to the code that handles them. It is the routing half of the separation, and it means the address a user sees is not tied to how the code is organised.
The database underneath is largely interchangeable, because the code above talks to the model layer rather than to a particular database. That portability is one of the framework's real benefits. Developing against a simple local database and deploying against a larger one is ordinary rather than a rewrite.
Forms and validation close the topic, and they deserve the most care because they are where user input enters the system.
The rule is one sentence. Never trust what arrives. Anything submitted was typed by someone you do not control. It may not have come from your form at all, and it may be designed to break something. Checks written into the page are for the convenience of an honest user and are not security; the browser is entirely under the sender's control.
So validation happens on the server, always, and it checks three things rather than one. That the input is present when required. That it has the right form. And that it is acceptable in context. That is the check nobody writes and the one that matters most: this user is allowed to change this record.
The framework supplies the machinery for the first two and for rendering the errors back to the user. The third is yours, and it is the one that is left out.
What you should now be able to explain or do
Name the three parts of the separation and say what each owns. Explain what the model layer generates from one description. Say why templates are deliberately limited and what inheritance prevents. Say why the underlying database is largely interchangeable. State the validation rule and name the three checks, including the one usually omitted.
Check yourself
What does the framework derive from a model description?
The database structure, a record of each change so the database can be updated, and an administrative interface.
Why are templates deliberately limited?
To keep logic in the code layer where it can be tested, and to keep the presentation readable by someone who is not a programmer.
What does template inheritance prevent?
Editing every page when shared structure changes. A base template holds what is common and each page fills the varying regions.
Why is checking input in the page not security?
The browser is under the sender's control. A request can be sent without using your page at all.
What are the three validation checks, and which is usually omitted?
Presence, form, and whether the action is acceptable in context. The third, whether this user may change this record, is the one left out.
Go deeper
We haven't checked most of these for screen reader use yet.