﻿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
17661	Foreign key with related name is not working properly.	davisito89@…	nobody	"I created a class Person and a class Email. The relationship is 1:n (a person can have many emails and an email belongs to only one person). My class Email contains an attribute named person = models.ForeignKey(u""Person"", related_name = u""emails""). Then I get some errors trying to get the emails of a single person:

1. I created a person.
Person.objects.create(id = 1)
2. I created two emails.
Email.objects.create(email = u""bla1"", person = Person.objects.get(pk = 1))
Email.objects.create(email = u""bla2"", person = Person.objects.get(pk = 1))
3. Try to get the emails of a person:
Person.objects.all()[0].emails.all()[0].email (prints ""bla2"", instead of ""bla1"")
Person.objects.all()[0].emails.all()[1].email (prints ""bla2"")
But,
[x.name for x in Person.objects.all()[0].emails.all()] prints ""bla1"" and ""bla2"" (which is the expected result)."	Bug	closed	Database layer (models, ORM)	1.3	Normal	invalid	related_name		Unreviewed	0	0	0	0	0	0
