﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
25461	Mistake in model _meta API migration guide for multi-table inheritance	ad-65	nobody	"The _meta API migration guide for Django 1.8 shows a replacement for _meta.get_all_related_objects() that isn't quite right when used on a multi-table inheritance child model.

{{{#!python

class Party():
    is_active = models.BooleanField(default=True)

class Contact(Party):
    first_name = models.CharField(max_length=128)
    last_name = models.CharField(max_length=128)
}}}

{{{#!python

[f for f in Contact._meta.get_all_related_objects()]
...
[]

[f for f in Contact._meta.get_fields() if (f.one_to_many or f.one_to_one) and f.auto_created]
...
[<django.db.models.fields.related.OneToOneField: party_ptr>]

}}}

The _meta.get_all_related_objects() method would return nothing assuming no other external relations but the replacement method would return the automatically created OneToOneField pointing to the parent. Maybe changing the docs to use is_concrete would work, unless this causes other problems?

{{{#!python

[f for f in Contact._meta.get_all_related_objects()]
...
[]

[f for f in Contact._meta.get_fields() if (f.one_to_many or f.one_to_one) and f.auto_created and not f.concrete]
...
[]

}}}"	Bug	closed	Documentation	1.8	Normal	fixed		romain.garrigues.cs@…	Accepted	1	0	0	0	0	0
