Skip to main content
Ctrl+K
Django Literature - Home Django Literature - Home
  • Home
  • Developer guide
  • Web interface
  • Reference
  • Contributing
  • Changelog
  • GitHub
  • Home
  • Developer guide
  • Web interface
  • Reference
  • Contributing
  • Changelog
  • GitHub

Section Navigation

Getting started

  • Set up a development environment
  • Run the tests and checks

Standards

  • Testing standards
  • Code documentation standards
  • Django standards
  • Documentation standards

Design

  • Decision records
    • ADR-0001 — citation_key is unique per import batch, not globally
    • ADR-0002 — Identifier types are open, not a closed enum
    • ADR-0003 — Names are role-neutral and shared; role and order live on ItemName
    • ADR-0004 — One date per CSL slot, stored as partial dates
    • ADR-0005 — Contributor ordering is scoped per (item, role) in the model, not via django-ordered-model
    • ADR-0006 — An imported entry is stored whole or not at all, by default
    • ADR-0007 — import_entry catches every exception by default, not a named few
    • ADR-0008 — A format mints a citation key for every entry it hands over
    • ADR-0009 — An import never matches against items already stored
    • ADR-0010 — A genuine fixture is one this project did not write
    • ADR-0011 — The RIS parser is hand-rolled, and takes no parsing library
    • ADR-0012 — A format owns its own decoding, and says which file mode it expects
    • ADR-0013 — No copyleft fixture enters this package
    • ADR-0014 — Cross-producer equivalence is proved over the material that exists, and labelled where it does not
    • ADR-0015 — A reference page is addressed by its primary key
    • ADR-0016 — The front end arrives through an optional extra
    • ADR-0017 — Identical stored names are not merged
    • ADR-0018 — A guard asserts on content, not on a status code
    • ADR-0019 — The repository holds data as source, never as a built database
    • ADR 0020 — The item type to field mapping is this package’s own artefact
    • ADR 0021 — Type scoping is presentation, never storage
    • ADR 0022 — The front end’s pages are open, including the ones that write
    • ADR 0023 — A citation key’s uniqueness is the reader’s concern, not the package’s
    • ADR 0024 — The catalogue search adds no index
    • ADR 0025 — One definition of what the catalogue narrows by
    • ADR 0026 — A format accepts a text or a binary handle
    • ADR-0027 — A skipped entry may carry a reason
    • ADR-0028 — An import previews first, and stages its file against the session
    • ADR-0029 — The format is chosen, never detected
    • ADR-0030 — The import page accepts an unbounded upload from anyone who can reach it
    • ADR 0031 — Completion suggests a spelling, never a record
    • ADR 0032 — A related row is kept by being rendered
    • ADR 0033 — The catalogue view is chosen by a setting, not by routing
    • ADR 0034 — A date slot is a field of the form, not a row of a set
    • ADR 0035 — The variables a citation processor assigns are not stored
    • ADR 0036 — Writing asks for a model permission
    • ADR 0037 — The reference picker is a django-tomselect field
  • Roadmap

Translating

  • Translations
  • Contributing
  • Decision records
  • ADR 0032 — A related row is kept by being rendered

ADR 0032 — A related row is kept by being rendered#

Status: accepted

Decision#

ADR-0021 keeps a reference’s scalar content safe by declaring every field on every form, so a hidden field posts its own value back and a change of item type discards nothing. Rows of related records (a reference’s contributors, its dates, its identifiers) do not inherit that guarantee, and it is upheld for them explicitly instead, in three parts:

  • A slot holding a value is always rendered, whatever the type mapping would lead with. What the mapping decides is what is offered, never what can be stored.

  • The parts of a related record the form does not offer are never declared on it, so a save through the form cannot write them.

  • Removal is explicit, through the formset’s own deletion, never implied by a row’s absence from a submission.

Why#

ADR-0021 names its own revisit condition: a write path that is not the rendered page. Inline formsets over related rows are that condition arriving, and the failure mode is not the one ADR-0021 was built against.

The two are genuinely different. An omitted scalar field is blanked, because Django assigns every declared field from cleaned data, so leaving one out writes empty rather than leaving it alone, and declaring everything is what makes that impossible. An omitted row is simply not there. No assignment happens, nothing is overwritten, and the row survives or does not depending on how the formset was told to read the submission. Declaring everything does not help, because there is no field to declare.

So the same guarantee needs a different mechanism, and the mechanism has to be stated rather than inherited. Left implicit, each of the three parts fails quietly, and in a way no test notices unless it is written to:

  • A date in a slot the reference’s current type does not lead with disappears from the page, and then from the record.

  • A field the form never meant to touch gets written as empty, because it was declared for some unrelated reason.

  • A row vanishes, because a submission did not mention it.

The third part is the one most worth spelling out. Treating absence as deletion means any truncated, filtered or partial submission silently removes rows, which is exactly the class of failure ADR-0021 exists to prevent, arriving through a different door.

What this rules out#

  • Building a related-row set from the item type alone. The type decides the starting point, and every slot already holding a value is added to it.

  • Declaring a related record’s full field list on its row form for convenience. Fields the form does not offer stay undeclared, so they cannot be written.

  • Reading a missing row as an instruction to delete.

Revisit if#

The write path gains a caller that is not the rendered page: an API, a partial update, or an import that writes through these forms. As with ADR-0021, the guarantee then has to move again, and this time there is no rendering step left to carry it.

previous

ADR 0031 — Completion suggests a spelling, never a record

next

ADR 0033 — The catalogue view is chosen by a setting, not by routing

On this page
  • Decision
  • Why
  • What this rules out
  • Revisit if
Show Source

© Copyright 2026, Sam Jennings.

Created using Sphinx 9.1.0.

Built with the PyData Sphinx Theme 0.23.0.