﻿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
6931	Backward relationships are overidden when Models Inherit	Jurian Botha <jurianbotha@…>	nobody	"When a model contains a reference another model and is then extended, calling the 'related_name' attribute of the referenced model only returns the related objects of the model that was last declared.


{{{
class Town(models.Model):
 name = models.CharField(max_length=255)

class Place(models.Model):
 town = models.ForeignKey(Town, related_name=""places"")
 address = models.CharField(max_length=255)

class Store(Place):
 cuisine = models.Charfield()
}}}


Now if I add the following data:


{{{
london = Town(name='London')
london.save()


placeA = Place(town=london, address='fake address A')
placeA.save()

placeB = Place(town=london, address='fake address B')
placeB.save()


resturantA = Resturant(town=london, address='fake address C', cuisine='bytes')
resturantA.save()
}}}


and then check the output of the following:

{{{
london.places.all()
}}}

it only returns the object 'resturantA' and doesn't include 'placeA' or 'placeB'.
"		closed	Database layer (models, ORM)	queryset-refactor		invalid			Unreviewed	0	0	0	0	0	0
