liveBook · Manning

Add mode

As explained in Django in Action

Add mode is the operating mode in which a form view creates a new object rather than modifying an existing one.

Add mode is the path through a form view that creates a new object instead of editing an existing one. A single view can support both jobs: use an item ID for editing and a default ID of 0 for adding. section 7.2.5

A typical request flow looks like this:

  • The add URL supplies no ID, so the view receives its default value, 0. section 7.2.5
  • A separate path carrying an integer ID switches the same view into edit mode. section 7.2.5

How Django in Action covers it

How deep it goes
Explains default IDs, routes, GET and POST branches, and ModelForm construction, stopping before complete save and validation code.
Examples
Demonstrates add and edit routes, a SeekingAdForm view, and New Ad and Edit links in the RiffMates application.
What it assumes
Assumes basic Python functions, Django views, forms, URLs, and ORM IDs while introducing the two-mode pattern.
What you can do after
Apply it via Django views and URL patterns to route new-object submissions through an existing form workflow.
How it connects
Connects add mode with edit mode, URL routing, ModelForm, ORM object IDs, and database-backed model instances.

This explainer was generated by Manning's knowledge graph from the text of Django in Action. The section links point to the parts of the book it draws on.