Skip to content

fix(action): register excludedParties/excludedRepresentatives as nested_fields

Scaffold Digital Fleet requested to merge fix/excluded-m2m-nested-fields into master

Root cause (live-verified, dev campaign 1384)

The two exclusion M2Ms were missing from ActionGroup.Meta.nested_fields, so djangoldp never registered their sub-container routes:

  • GET /actiongroups/1384/excludedRepresentatives/ → 406 / HTML fallback
  • same for excludedParties/ → 406 / HTML
  • comparison: specificTargetedRepresentatives/ and contactPlateforms/ → 200 ldp:Container

The front cherry-picker (expand: true on both fields, risefor-front !81) had no container to expand through, and sib-core collapsed N=1 M2M values to the element itself — the exclusion filters silently never engaged on the action page (party exclusion !37 (merged) affected identically for N=1 campaigns).

Fix

One line: register excludedParties + excludedRepresentatives in nested_fields, same as their M2M siblings.

Verification (dev, post backend restart)

  • Both sub-container routes return 200 with proper ldp:Container payloads (N=1 included)
  • Parent payload ships both fields as containers (same shape as specificTargetedRepresentatives)
  • List endpoint healthy (47 actions, inline containers, no size regression)
  • manage.py check: 81 issues = pre-existing baseline (W042 x76, W340 x4, W005 x1), zero new
  • End-to-end on the live dev page (CDP, cache-busted): postal filter drops the excluded rep on load (2188 → 2056, Simonnet absent); excludedParties N=1 now arrives natively as an array

Notes

  • No migration: Meta routing-only, no model-state change. Fork-safe (plain list extension of this package's own fields, no cross-package references).
  • Companion front commit on risefor-front !81 (b2c5e6f4) keeps the normalizePartyRefs shape-hardening as a safety net: Representative-typed N=1 values still collapse in sib-core even with the route present (hypothesis: rdf-type known to the store), and payloads shipped before this backend change stay filtered.

Merge request reports