What you will learn in Django in Action
Chapter by chapter
Concepts explained in this book
- view functionA Django view is a function or class that receives an HTTP request and returns an HTTP response.
- DjangoDjango is an open-source Python web framework for building web applications and managing web content.
- request messagePOST is the HTTP request method used to submit data to a server, commonly for creating or changing server-side state.
- django-admindjango-admin is Django's command-line utility for creating projects and running configuration or management actions.
- hx-get attributehx-get is an HTMX attribute that initiates an HTTP GET request when its attached HTML element is interacted with.
- migration fileA migration script is a generated Python program that applies a specific change to a Django database schema or its data.
- ModelFormA ModelForm is a Django form class generated from a model that maps form fields to model fields and can create or update model instances.
- subtemplateA subtemplate is a reusable template fragment that can be rendered independently as an HTML response segment or included in another template.
- migrationA Django migration is a versioned description of database schema changes derived from changes to application models.
- ModelSchemaModelSchema is a Django Ninja schema class that derives field definitions and requiredness from a Django ORM model.
- query managerA Django query manager is an object that constructs queries for retrieving model instances, including objects related through a foreign key.
- serializationSerialization is the conversion of in-memory objects or data structures into a representation suitable for storage or transmission.
- makemigrationsmakemigrations is a Django management command that generates migration files from changes to application models.
- filter()filter() is a Django query method that returns a QuerySet containing objects matching supplied field lookups.
- hx-trigger attributehx-trigger is an HTMX HTML attribute that specifies the browser event and timing conditions that initiate an HTMX request.
- Django NinjaDjango Ninja is a Django library for defining and implementing web APIs with typed request and response schemas.
- Django projectA Django project is the site-level structure and configuration that contains application code and interacts with a web server to handle visits.
- object-relational mapperAn object-relational mapper maps application objects and their operations to relational database records and queries.
- FormA Django form object is an instance representing form fields, submitted values, and validation errors, and can render its HTML.
- deletionDELETE is an HTTP method that requests removal of a resource identified by a URL.
- HTMXHTMX is a JavaScript library that enables HTML elements to initiate HTTP interactions and update portions of a page.
- management commandA management command is a Django command-line operation exposed through Django's management-command system.
- authenticationAuthentication is the process of verifying a user's identity before granting access to an API or other resource.
- user profileA user profile is a model object that stores additional data associated with a user account and related domain objects.
- Django test classDjango TestCase is Django's database-aware testing class that extends unittest.TestCase with web-testing and transactional test-database features.
- hx-target attributehx-target is an HTMX attribute that identifies the HTML element whose content or element is affected by an HTMX response.
- migrate commandThe Django migrate command applies available migration scripts to synchronize a database with the application's migration state.
- settings.pysettings.py is the Django project configuration module containing declarations that define project behavior.
- test runnerA test runner is a software component that discovers, selects, and executes automated tests.
- queryset()queryset() is a SimpleListFilter method that receives a QuerySet and returns the filtered QuerySet for the changelist.
- type hintsOptional Python syntax that annotates the expected type of a value, parameter, attribute, or return result.
- ForeignKeyForeignKey is a Django model field that represents a many-to-one relationship by referencing an object in another model.
- BaseCommandBaseCommand is Django's base class for implementing management commands and their command-line behavior.
- URL argumentA URL argument is a value captured from part of a URL and passed as an argument to a view.
- Waffle FlagA Django Waffle feature flag that controls feature availability according to configured visitor, group, percentage, cookie, testing, and override criteria.
- endless scrollInfinite scroll is an interface technique that progressively loads and appends additional content as the user approaches the end of a scrollable page.
- authorizationAuthorization is the process of determining which actions or resources an authenticated user is permitted to access.
- HTTP PUT methodPUT is an HTTP method that requests creation or replacement of a resource representation at a specified URL.
- PATCHPATCH is an HTTP method that requests partial modification of a resource using only changed fields.
- startproject commandThe startproject command is a Django administrative command that creates the initial files and directories for a Django project.
- validationValidation is the process of checking whether a value satisfies specified correctness or format constraints.
- admin.ModelAdminadmin.ModelAdmin is Django's base class for configuring how a model is managed in the Django Admin.
- serializerA serializer is a component that converts application objects or data into a transport representation and may reconstruct objects from that representation.
- single-page applicationA single-page application is a web application that renders its interface and performs substantial application logic in the browser within a single web page.
- templating languageA template language is a language embedded in templates for replacing values, accessing data, and controlling rendered output.
- development serverThe Django development server is Django's built-in web server for local development and testing.
- RunPythonRunPython is a Django migration operation that executes supplied Python functions when migrating forward or backward.
- middlewareMiddleware is software that sits in a request-processing pipeline and can modify processing or prevent a downstream handler from being called.
- CommandErrorCommandError is a Django exception type for reporting errors from management commands without displaying a stack trace by default.
- login_requiredlogin_required is a Django view decorator that restricts access to authenticated users and redirects unauthenticated requests to login.
- Django ModelDjango Model is the base class whose subclasses define database-backed data models and their fields.
- runserver commandThe runserver command is a Django management command that starts the built-in development server.
- Django configuration directoryA Django configuration directory is the project package containing modules that define URL mappings, project settings, and other generated configuration.
- manage.pymanage.py is a project-local Python utility script that invokes Django management and configuration commands for a project.
- Django appA Django application is a modular component of a Django project that groups related views, models, and configuration.
- django-distilldjango-distill is a Django library that renders selected project URLs into static website files.
- virtual environmentA Python virtual environment is an isolated environment containing a separate package installation and interpreter context for a project.
- CharFieldCharField is a Django model field type for storing character strings with a configurable maximum length.
- renderThe Django render shortcut creates an HTTP response by loading a template, combining it with context data, and rendering the result.
- HTTP methodAn HTTP method is a standardized operation token indicating the intended action for an HTTP request.
- django-htmxdjango-htmx is a Django library that integrates HTMX request information into Django request processing, including through middleware.
- hx-push-urlhx-push-url is an HTMX HTML attribute that updates the browser history URL when an HTMX request completes.
- q objectA Q object is a Django ORM expression object for composing complex query conditions with logical operators such as AND and OR.
- request.htmxrequest.htmx is the django-htmx request attribute that exposes information about whether and how HTMX initiated a request.
- revealedrevealed is an HTMX trigger value that fires when an element becomes visible in the browser viewport.
- widgetA Django form widget is an object that renders a form field as a specific HTML input element and its attributes.
- reversible migrationA reversible migration is a migration that defines operations for both applying and undoing its changes.
- one-to-many relationshipA one-to-many relationship associates one record with multiple records of another type, while each of those records is associated with one record of the first type.
- path objectA Django path object represents a URL pattern and the view reference associated with that pattern.
- blankA Django model-field option that determines whether Django Admin and web forms treat the field as required.
- static fileA static file is a file whose contents remain unchanged while being served, typically containing presentation assets such as stylesheets, scripts, or images.
- multipart/form-datamultipart/form-data is an HTTP media type for encoding form fields and uploaded files as separate parts of one request body.
- request.FILESrequest.FILES is the Django request collection containing files uploaded through a multipart form submission.
- key-based authenticationKey-based authentication is a request-authentication technique that verifies access by requiring a secret key, typically supplied in a request header.
- HTTP 404 errorHTTP 404 Not Found is an HTTP response status indicating that the requested resource could not be found.
- user-interaction testingUI testing evaluates software by interacting with its user interface, often through tools that simulate user actions.
- field lookupA Django ORM field lookup is a double-underscore query-argument suffix that specifies how a model field value is compared or restricted.
- cleaned_datacleaned_data is a Django form mapping containing the validated, converted value for each form field.
- is_valid()is_valid() is a Django form method that validates bound form data, records validation results, and returns whether the form is valid.
- save()save() is a Django method that persists a model instance, or a model instance produced by a ModelForm, to the database.
- get_object_or_404get_object_or_404 is a Django shortcut that retrieves an object matching query criteria or raises Http404 when no matching object exists.
- hx-post attributehx-post is an HTMX attribute that initiates an HTTP POST request when its attached HTML element is interacted with.
- integration testAn integration test is an automated test that verifies interactions between multiple software components or systems.
- contractAn API is a defined interface through which software components exchange requests, responses, or data.
- acceptance testingAn acceptance test verifies that software satisfies requirements from the perspective of an expected feature or user outcome.
- form fieldA form field is a Django form component representing an input value along with its rendering and validation behavior.
- apps.get_model()apps.get_model() retrieves a model representation corresponding to a particular historical migration state.
- backup and restoreA database backup is a restorable copy of database contents and structure saved separately from the live database.
- deprecationDeprecation is the practice of announcing that an existing interface or field will be removed after a transition period.
- historical model stateA historical model state is the version of a model defined by the migrations up to a particular point in migration history.
- modelform_factorymodelform_factory is a Django function that dynamically creates a ModelForm class from a model and configuration options.
- password reset flowPassword reset is the process of replacing a user's forgotten or compromised password after verifying control of the associated account.
- positional argumentA Python positional argument is an argument assigned to a parameter according to its position in the argument list.
- test databaseA test database is an isolated database created for executing automated tests without modifying application data.
- database transactionA database transaction is an atomic group of database actions that either completes as a unit or can be rolled back as a unit.
- Django ORMThe Django ORM is Django's object-relational mapping system for representing and querying database records through Python objects.
- click-to-editClick-to-edit is an inline-editing interaction pattern in which displayed data changes into an editable form after the user clicks it or a control.
- email backendA Django email backend is a pluggable component that delivers email messages through a configured transport or output destination.
- decoratorA decorator is a Python language construct that associates additional behavior or metadata with a function or class.
- NinjaAPINinjaAPI is Django Ninja's primary API class for registering endpoints and configuring API behavior such as authentication.
- feature flagA feature flag is a conditional control that enables or disables application functionality according to configuration or runtime criteria.
- Django Debug ToolbarDjango Debug Toolbar is a Django add-on that displays diagnostic information about request processing, performance, and resources used to generate a response.
- API keyAn API key is a secret token used to identify or authorize a client making API requests.
- add_arguments()add_arguments() is the Django management-command method that receives an argument parser and registers command-line arguments.
- Django signalA Django signal is an event-notification mechanism that allows registered receivers to respond when specified framework or application events occur.
- MEDIA_ROOTMEDIA_ROOT is a Django setting defining the filesystem directory where user-uploaded media files are stored.
- ManyToManyFieldManyToManyField is a Django model field that defines a many-to-many relationship through an intermediary relationship table.
- send_mail()send_mail() is a Django function that sends an email through the configured email backend.
- clean()clean() is a Django model method that performs object-level validation and can raise a validation error for invalid field relationships.
- endpointAn API endpoint is a network-accessible interface location that receives requests and returns API responses.
- model fieldA Django model field defines a model attribute together with its database storage, validation, and related behavior.
- static template tagThe Django static template tag generates or resolves the URL of a static file using the configured static-file settings.
- accountA user account is a stored identity record representing a person who can access a system.
- system checkA Django system check is an automated inspection of project configuration and application setup for problems.
- Django AwlDjango Awl is a third-party Django library providing reusable model classes, administration helpers, view decorators, context processors, commands, and testing utilities.
- DateFieldDateField is a Django model field for storing calendar dates in a database column.
- multiuser siteA multiuser site is a web application that supports separate user identities, accounts, and permissions or personal experiences.
- slugA slug is a short, URL-compatible textual identifier or descriptive name for a resource.
- capture specifierA capture specifier is angle-bracket URL syntax that declares a captured value's type and name for a view argument.
- debugging modeDEBUG is a Django setting that controls whether detailed diagnostic information is displayed for errors.
- Http404Http404 is a Django exception indicating that a requested resource or object could not be found.
- include functionDjango's include function incorporates URL patterns from another module under a specified path prefix.
- list_filterlist_filter is a ModelAdmin configuration option specifying fields or filter classes that provide sidebar filters for a changelist.
- URL routing fileA URL routing file is a Python module that defines URL patterns for an application or included route namespace.
- django-extensionsdjango-extensions is a third-party Django package that provides additional management commands, model and field classes, signals, and development utilities.
- --empty flagThe makemigrations command-line option that creates an empty migration file without operations.
- relationship tableA relationship table is an intermediate database table that records associations between rows in two related tables.
- post_savepost_save is a Django ORM signal emitted after a model instance has been saved.
- signal handlerA signal handler is a callable that receives a signal notification and performs corresponding application logic.
- TEMPLATES settingThe TEMPLATES setting is the Django settings configuration that selects template engines and controls where template files are searched for.
- unittestunittest is Python's standard-library framework for defining, discovering, running, and reporting automated tests.
- web formA web form is an HTML-based interface through which a user enters and submits data to a web application.
- urlpatternsurlpatterns is the Django URL-configuration variable containing a list of path objects.
- urls.pyurls.py is a Django Python module that defines URL mappings for an application.
- validatorCode that checks whether a value satisfies specified criteria and raises a validation error when it does not.
- class-based viewA class-based view is a Django view implemented as a Python class whose methods handle requests and produce responses.
- test setupsetUp is a test lifecycle method invoked before each test method to prepare its required state.
- AnonymousUserAnonymousUser is Django's user object representing a request made by someone who is not authenticated.
- enctype attributeenctype is an HTML form attribute that specifies the encoding used for submitted form data.
- on_deleteon_delete is a Django ForeignKey parameter specifying the behavior applied to a relationship when the referenced object is deleted.
- related_namerelated_name is a Django relationship-field option that sets the attribute name for traversing from a referenced object to related objects.
- Django test clientThe Django test client is a test utility that simulates requests to a Django application and supports authentication and HTTP method calls.
- showmigrationsshowmigrations is a Django management command that lists a project's migrations and indicates which ones have been applied.
- add_argumentadd_argument() is an argparse parser method that defines one positional argument or flag and its parsing options.
- argparseargparse is a Python standard-library module for parsing command-line arguments and converting them into structured values.
- argparse namespaceAn object whose attributes contain values parsed from command-line arguments.
- Django REST FrameworkDjango REST Framework is a Django library for building web APIs, including request handling, serialization, and representation of application data.
- SimpleListFilterSimpleListFilter is a Django Admin base class for defining custom sidebar filters with selectable lookup values and QuerySet filtering behavior.
- FieldField is a Django Ninja schema-field class that declares field behavior and can provide an external alias for a field name.
- PydanticPydantic is a Python library for declaring data schemas with type annotations and validating or serializing structured data.
- SQLSQL is a declarative language for defining, querying, and modifying data in relational databases.
- handle()The BaseCommand method that Django invokes to perform a management command's action.
- SafeStringSafeString is a Django string subclass whose contents are marked as safe from automatic HTML escaping.
- WSGIWSGI is the Python Web Server Gateway Interface standard for connecting web servers with Python web applications.
- django-crispy-formsdjango-crispy-forms is a Django library for rendering and customizing styled HTML forms through reusable helpers, layouts, and template packs.
- if tagAn if tag is a Django template instruction that conditionally renders its enclosed block according to a Boolean condition.
- API namespaceA naming scope that distinguishes endpoint names within a versioned or grouped API configuration.
- slugify()slugify() is a Django utility function that converts text into a lowercase, URL-compatible slug.
- SeekingAdSeekingAd is the book's Django model representing a classified advertisement from a musician seeking a band or a band seeking a musician.
- template directoryA template directory is a filesystem directory containing templates that a template engine can discover and load.
- Django WaffleDjango Waffle is a Django package for controlling feature availability through switches, percentage-based samples, and user-targeted flags.
- foreign keyA foreign key relationship is a database relationship in which records in one table reference a record in another table through a foreign key.
- testing pyramidA testing pyramid is a model that organizes software tests into levels based on scope, speed, and execution cost.
- template inheritanceTemplate inheritance is a templating technique in which a child template extends a parent template and overrides or fills its defined blocks.
- CreateModelCreateModel is a Django migration operation that creates a model and its corresponding database table.
- FileFieldA FileField is a Django model field that stores a reference to an uploaded file and manages its file path.
- ImageFieldAn ImageField is a Django model field for uploaded files that validates image content.
- static site generatorA site generator is a tool that produces deployable website files from source content, templates, or application data.
- behavior-driven developmentBehavior-driven development is a software development approach that specifies and tests requirements-level behavior before or alongside implementation.
- test-driven developmentTest-driven development is a software development approach in which tests are written before the implementation they verify.
- observer patternThe observer/observable pattern is a design pattern in which observers register interest in an observable and receive notifications when its state or activity changes.
- receiver decoratorThe Django receiver decorator registers a callable as a handler for a signal from a specified sender.
- crispy filterThe crispy filter is a Django template filter that renders a form object using the installed django-crispy-forms template pack.
- crispy template tagThe crispy template tag is a django-crispy-forms template tag that renders a form according to its configured helper, layout, and template pack.
- mark_safemark_safe is a Django utility that marks a string as safe HTML and returns a SafeString.
- server-side renderingServer-side rendering is the composition of a web page's HTML on the server before it is sent to a browser.
- custom template tagA custom template tag is an application-defined template instruction that performs an operation during template rendering.
- static resource directoryA static directory is a filesystem directory containing files that a web application serves as static assets.
- Django Ninja docsDjango Ninja docs is an interactive API documentation interface that displays endpoints, schemas, requests, and responses and can execute calls.
- cross-site request forgeryCross-site request forgery is a web attack that tricks an authenticated user’s browser into submitting an unintended state-changing request to a site.
- add pageAn add page is a Django Admin page containing a form for creating a new database object.
- change pageA change page is a Django Admin page containing a form for editing an existing database object.
- CRUDCRUD is the set of data operations consisting of create, read, update, and delete.
- register()register() is the Django Admin function or decorator that associates a model with an administrative configuration class.
- dotted notationDot notation is syntax that accesses attributes, collection items, dictionary values, or no-argument callables through period-separated names.
- inline editingInline editing is a user-interface pattern in which an item is replaced in place by controls for modifying it.
- migration squashingsquashmigrations is a Django management command that combines a specified range of an app's migrations into a new migration file.
- autoescape tagThe Django autoescape tag controls whether automatic HTML escaping is enabled for a template block.
- format_htmlformat_html is a Django utility that formats arguments into an HTML string and returns a SafeString.
- HTML escapingHTML escaping replaces characters with special meaning in HTML with representations that are displayed as text rather than interpreted as markup.
- safe filterThe Django safe filter marks template output as trusted HTML so the value is not automatically escaped.
- assertEqualassertEqual is a Python test method that checks whether two values are equal and reports a failed assertion otherwise.
- assertion methodAn assertion method is a test operation that checks a stated condition and raises an exception when the condition is false.
- tests.pytests.py is the conventional Django application module containing tests for the application.
- HTMX attributeAn HTMX attribute is a custom HTML attribute that declares an HTTP interaction or specifies how its result affects a page.
- hx-swaphx-swap is an HTMX attribute that specifies how returned HTML is inserted into or used to replace a target element.
- MEDIA_URLMEDIA_URL is the Django setting that specifies the base URL used to serve media files.
- setattr()setattr() is a Python built-in function that assigns an attribute on an object using an attribute name and value.
- dbshell commandThe dbshell command is a Django management command that opens the interactive command-line tool for the database configured by a project.
- Model–view–controllerModel–view–controller is an architectural pattern that separates an application into data and business logic, presentation, and interaction-control components.
- shell_plusshell_plus is a django-extensions management command that opens a Django shell with commonly used modules, classes, functions, and optionally selected models pre-imported.
- GrapheneGraphene is a library for building GraphQL schemas and APIs in Python applications.
- GraphQLGraphQL is a query language and API runtime in which clients specify the data and operations they want through a schema-defined query.
- inter-field validationInter-field validation is validation that checks consistency or dependencies among multiple fields of the same model object.
- TextChoicesTextChoices is a Django class for defining enumeration-like model-field choices with database values and human-readable labels.
- ValidationErrorValidationError is a Django exception indicating that a value or object fails validation.
- model-level validationValidation performed by a Django model before its values are saved to the database.
- paginatorPaginator is a Django utility class that divides an iterable or query result into page-sized subsets and provides access to those pages.
- form.as_pform.as_p is a Django Form method that renders form fields wrapped in HTML paragraph elements.
- Django GrappelliDjango Grappelli is a third-party Django package that replaces the default Django administration interface with an alternative user interface.
- load tagThe Django load tag imports template tag modules into a template's namespace.
- one-to-one relationshipA one-to-one relationship is a relationship in which each record on one side corresponds to at most one record on the other side.
- stacked inline formadmin.StackedInline is Django's base administrative class for defining vertically stacked inline forms for related model objects.
- UserAdminUserAdmin is a Django Admin class for configuring the administration interface for User model records.
- Waffle SampleA Waffle Sample is a Django Waffle feature control that enables a feature for a configured percentage of visitors.
- reverse()reverse() is Django's URL-reversing function that resolves a named URL pattern into its URL string.
- controllerThe MVC controller is the component responsible for handling interactions with application data and coordinating application behavior.
- add modeAdd mode is the operating mode in which a form view creates a new object rather than modifying an existing one.
- authenticated userAn authenticated user is a site visitor whose identity has been verified through a logged-in account.
- edit modeEdit mode is the operating mode in which a form view modifies an existing object.
- ownership checkAn ownership check verifies that the authenticated user is authorized to modify the requested resource.
- two-mode viewA two-mode view is a single view that handles both creation of new objects and editing of existing objects.
- two-route designA two-route design maps separate add and edit URL patterns to the same view.
- debug toolbar panelA Django Debug Toolbar panel is a configurable diagnostic component that displays a category of information about a request or view execution.
- dumpdatadumpdata is a Django management command that serializes database data, optionally filtered by application, into a fixture.
- loaddataloaddata is a Django management command that deserializes fixture data from a filename or application and loads it into a database.
- custom user modelA custom user model is an application-defined model that replaces Django's built-in user model and can define different account data and credential behavior.
- OneToOneFieldOneToOneField is a Django model field that creates a one-to-one relationship, so each object on either side relates to at most one object on the other side.
- django.contrib.auth.urlsdjango.contrib.auth.urls is a Django URL module containing URL mappings for built-in authentication and user-management views.
- call_command()A Django function that invokes a management command programmatically from Python code.
- APIKeyHeaderAPIKeyHeader is a Django Ninja security base class for implementing API-key authentication from an HTTP header.
- base templateA parent template is a template whose structure and blocks are inherited by another template.
- Django authenticationDjango authentication is the built-in Django mechanism that authenticates users through Django's user and session system.
- template blockA template block is a named section of a template delimited by paired template tags that can be replaced by a child template.
- AddFieldAddField is a Django migration operation that adds a model field and its corresponding database column.
- setUpClasssetUpClass is a class-level test lifecycle method invoked once before the tests in a test class run.
- password managementPassword management is the handling of user passwords, including their creation, storage, and maintenance.
- list_displaylist_display is a Django ModelAdmin option that specifies the fields or callables rendered as columns on an administration listing page.
- collectstaticcollectstatic is a Django management command that copies an application's static files to a configured deployment destination.
- distill-localdistill-local is a django-distill management command that generates a static site in a specified output directory.
- distill_pathdistill_path is a django-distill URL-mapping function that associates a view with a route and the filename to generate for it.
- uriA URL is a standardized locator that identifies a resource or endpoint on a network.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.
