﻿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
17043	Model subclass field named the same as one of the parent model subclasses clashes	Simon Charette	nobody	"The following model inheritance should raise a warning on model validation:
{{{
#!python
from django.db import models

class A(models.Model):
    pass

class B(A):
    pass

class C(A):
    b = models.BooleanField()

print A.b
#<django.db.models.fields.related.SingleRelatedObjectDescriptor object at 0x1b08e10>
print B.b
#<django.db.models.fields.related.SingleRelatedObjectDescriptor object at 0x1b08e10>
print C.b
#<django.db.models.fields.related.SingleRelatedObjectDescriptor object at 0x1b08e10>

C.objects.create(b=False)
#ValueError: Cannot assign ""False"": ""C.b"" must be a ""B"" instance.
}}}

Took me some time before figuring out what was happening. Feel free to rename the ticket with a more descriptive title.

Is there a reason why the {{{RelatedObjectDescriptor}}} is also added to the subclasses of {{{A}}} and not only the parent model? Lets say I have a {{{c = C}}} instance, theres no way {{{c.b}}} might return something, only {{{a = A}}} might do?"	Bug	closed	Database layer (models, ORM)	1.3	Normal	duplicate			Accepted	0	0	0	0	0	0
