Opened 13 years ago

Last modified 13 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
Pull Requests:How to create a pull request

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.

According to the ticket's flags, the next step(s) to move this issue forward are:

  • To provide a patch by sending a pull request. Claim the ticket when you start working so that someone else doesn't duplicate effort. Before sending a pull request, review your work against the patch review checklist. Check the "Has patch" flag on the ticket after sending a pull request and include a link to the pull request in the ticket comment when making that update. The usual format is: [https://github.com/django/django/pull/#### PR].

Change History (2)

comment:1 by Aymeric Augustin, 13 years ago

Type: UncategorizedCleanup/optimization

comment:2 by Aymeric Augustin, 13 years ago

Triage Stage: UnreviewedAccepted

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