Django Courses
1Django Tutorials
14
How to Build a Multilingual Website with Django i18n
Learn how to enable and configure Django’s translation system (i18n) to create multilingual websites. This tutorial walks you through setting up langu...
Lesson
How to use Django Context Processors
This tutorial covers Django context processors, showing how custom processor functions inject site-wide data into every template, how to register them...
Lesson
What's the difference between `annotate()` and `aggregate()`?
Separates the terminal call from the chainable one: aggregate() returns a dict summarising the whole queryset, while annotate() attaches a value to ev...
Lesson
What does `transaction.atomic()` actually guarantee?
Explains that an atomic block commits on a clean exit and rolls back when an exception escapes it, that nested blocks open savepoints rather than tran...
Lesson
What's the difference between a custom Manager and a custom QuerySet?
Explains that a Manager is the model's entry point and a QuerySet is the chainable result it hands out, which is why a method on the Manager can only ...
Lesson
How does Django middleware wrap a request?
Explains the two-layer shape of a Django middleware: a factory called once at startup returning a per-request callable, wrapped inside out so MIDDLEWA...
Lesson
What does Django's `Paginator` do to your queryset?
Shows that a Django page is a lazy queryset slice compiled into LIMIT and OFFSET plus a separate COUNT query, why an unordered queryset makes pages un...
Lesson
Why do `Q` and `F` exist when `filter()` already takes keyword arguments?
Explains the two limits of keyword arguments to filter(): they can only be ANDed, and the right-hand side is always a value. Q makes conditions combin...
Lesson
What's the difference between `get()`, `filter()`, and `all()` on a queryset?
Separates the lazy queryset methods from the eager one: filter() and all() clone a Query and run nothing, while get() executes immediately with a LIMI...
Lesson
What's the difference between `.save()` and `.update()`?
Separates the instance method from the queryset method: save() writes every column of one row and runs overrides, signals and auto_now, while update()...
Lesson
What's the difference between `select_related()` and `prefetch_related()`?
Separates the two by the SQL they emit: select_related adds a JOIN and returns everything in one query, while prefetch_related runs a second query and...
Lesson
What does Django's `TestCase` give you that `unittest.TestCase` does not?
Explains what Django's TestCase adds to plain unittest: a disposable test database, and a transaction around every test method that is rolled back aft...
Lesson
How does Django match a URL to a view?
Explains that Django tries urlpatterns top to bottom and stops at the first full match, so order is the only ranking. Covers what each path converter ...
Lesson
What's the difference between `values()`, `values_list()`, and model instances?
Compares what each queryset form builds per row: instances select every column and carry model behaviour, while values() and values_list() narrow the ...