From 2a49d8e9b25581dc601520023861a772e829c14b Mon Sep 17 00:00:00 2001 From: Romain Garrigues <romain.garrigues@makina-corpus.com> Date: Wed, 6 Jul 2016 14:28:37 +0100 Subject: [PATCH] [1.8.x] Fixed #25461 -- Corrected meta API code examples to account for MTI. In the case of multiple-table inheritance models, get_all_related_objects() and get_all_related_objects_with_model() don't return the auto-created OneToOneField, but the new examples didn't account for this. Backport of 8be84e2ac42b2556fd6fa07794b3708b143ef341 from master --- docs/ref/models/meta.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/ref/models/meta.txt b/docs/ref/models/meta.txt index d8f711b810..fa4956cd92 100644 --- a/docs/ref/models/meta.txt +++ b/docs/ref/models/meta.txt @@ -240,7 +240,8 @@ can be made to convert your code to the new API: [ f for f in MyModel._meta.get_fields() - if (f.one_to_many or f.one_to_one) and f.auto_created + if (f.one_to_many or f.one_to_one) + and f.auto_created and not f.concrete ] * ``MyModel._meta.get_all_related_objects_with_model()``:: @@ -248,7 +249,8 @@ can be made to convert your code to the new API: [ (f, f.model if f.model != MyModel else None) for f in MyModel._meta.get_fields() - if (f.one_to_many or f.one_to_one) and f.auto_created + if (f.one_to_many or f.one_to_one) + and f.auto_created and not f.concrete ] * ``MyModel._meta.get_all_related_many_to_many_objects()``::