Open j4mie opened 2 years ago
Concern about this is that it doesn't compose nicely. This won't work:
prepare, project = specs.process([
"title",
{"publisher_id": pairs.related_field("publisher", "id")},
{"publisher_name": pairs.related_field("publisher", "name")},
])
You'd need to do this as a projector pair instead to avoid trying to prefetch the same queryset twice. Needs more thought.
I wonder if this would serve the use-case I have in #97 🤔
This generalises the
pk_list
functions (which were added specially to sort-of replace a feature that existed in SSM) to allow fetching the value or values of any field from a related object or objects.Example:
The existing
pk_list
functions have been refactored to userelated_field
.