Opened 4 years ago

Last modified 3 years ago

#17752 new Cleanup/optimization

Serialization and multi-table inheritance

Reported by: issarisc@… Owned by: nobody
Component: Documentation Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The section on serializing models using multi-table inheritance is rather unhelpful IMHO. The solution the example suggests is of very limited use: They only show how to query all parent Model objects and all child Model objects and concatenate these lists.

In practice, I think it would be rather unlikely that anyone would want to use it like this, as the results of both queries are not connected in any way.

A more likely use-case would be if someone was querying the Restaurant Model, and would want to show the name of the restaurant for each of the results in the resulting QuerySet.

The documentation gives no solution or hint in the right direction regarding this, so I assume the only way would be to create a new list myself with the combined results and serializing that list.

Change History (2)

comment:1 Changed 3 years ago by aaugustin

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Type changed from Uncategorized to Cleanup/optimization

comment:2 Changed 3 years ago by aaugustin

  • Triage Stage changed from Unreviewed to Accepted

I'm not sure of what the best practice is, but it seems there's room for improving the docs. Accepting on this basis.

Note: See TracTickets for help on using tickets.
Back to Top