Implement bulk add_parent via ElementQuerySet.add_parent
A QuerySet-level equivalent of Element.add_parent
, that adds a single parent to every element selected in the QuerySet. This could make CreateParentSelection
faster and perhaps allow it to preserve ordering (#1469).
Having it operate on any QuerySet makes it very flexible, which can help when doing weird things in a shell, but it can also make it quite complex:
- Should elements that belong to a corpus other than the parent element be skipped or make the method crash?
- Should elements that would cause cycles be skipped or make the method crash?
- Should elements that already have the parent be skipped or make the method crash?
- Can we update existing paths even when the elements have wildly different existing paths, or should this only operate by adding then removing?
Some whiteboard work is required!