Commit 8be84e2a authored by Romain Garrigues's avatar Romain Garrigues Committed by Tim Graham
Browse files

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.
parent 43d0345f
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -215,7 +215,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()`` becomes::
@@ -223,7 +224,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()`` becomes::