English for Django Developers
Learn the English vocabulary Django developers need for discussing models, migrations, the ORM, and middleware clearly in code reviews and standups.
“The migration is broken” could mean the schema change itself failed, the migration file is out of order, or a data migration is timing out on a large table — and Django’s vocabulary is precise enough to tell your team exactly which one you mean.
Key Vocabulary
Model — a Python class that defines the shape of a database table, including its fields and relationships, serving as the single source of truth Django uses to generate the actual schema. “Don’t add that field directly in the database — add it to the model first and generate a migration, or the ORM and the actual table will drift out of sync.”
Migration — a versioned, ordered file that describes a specific change to the database schema, generated from model changes and applied in sequence so every environment ends up with an identical schema history. “That migration is stuck in the review queue because it renames a column on a table with 40 million rows — we need to talk about whether it needs to run as a separate data migration first.”
QuerySet — a lazily evaluated collection of database rows returned by the ORM, which only executes the actual SQL query when it’s iterated over, sliced, or explicitly evaluated. “That view is slow because it’s iterating over the queryset twice, which fires two separate database queries — caching it in a list after the first evaluation would fix it.”
Middleware — a component that processes requests and responses globally before they reach a view or after a view returns, used for cross-cutting concerns like authentication, logging, or CORS headers. “The 403 isn’t coming from the view itself — there’s a middleware earlier in the stack that’s rejecting the request before it ever reaches your permission check.”
Signal — a mechanism that lets one part of the application notify other parts when a specific event occurs, such as a model being saved, without those parts being directly coupled to each other.
“That side effect is happening because of a post_save signal on the model, not because of anything in this view — check signals.py before you assume the bug is here.”
Common Phrases
- “Is this a schema-level migration, or does it also need a data migration?”
- “Is that queryset actually being evaluated once, or is it re-querying every time it’s used?”
- “Which middleware is intercepting this request before it hits the view?”
- “Is this behavior coming from a signal somewhere, or is it happening directly in the view?”
- “Did the migration get applied in every environment, or just locally?”
Example Sentences
Reviewing a migration in a pull request: “This migration adds a NOT NULL column without a default, which will fail against the existing rows in production — either add a default or split this into two migrations: add the nullable column, backfill it, then make it required.”
Debugging a queryset performance issue:
“The N+1 query problem here is coming from accessing .author.name inside the loop — using select_related('author') on the original queryset would pull that data in a single join instead of one query per row.”
Explaining a signal-based bug: “The duplicate email isn’t being sent by this view — there’s a post_save signal on the Order model that also triggers a notification, so when this code saves the order, it’s firing twice.”
Professional Tips
- Distinguish a schema migration from a data migration explicitly in reviews — the first changes structure, the second changes data, and conflating them is a common source of production incidents on large tables.
- Say queryset precisely, not just “query,” when discussing ORM performance — it signals you understand Django’s lazy evaluation model, which is usually the actual root cause of N+1 problems.
- Name the specific middleware responsible for unexpected request behavior rather than describing it vaguely as “something in the request pipeline” — it points teammates directly at the right file.
- Flag signal-based side effects explicitly in code reviews — they’re easy to miss because they’re not visible at the call site, and undocumented signals are a recurring source of confusing bugs.
Practice Exercise
- Explain the difference between a schema migration and a data migration to a teammate.
- Describe what makes a queryset “lazy” and why that matters for performance.
- Write a sentence explaining why a signal-based side effect can be harder to debug than an explicit function call.