﻿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
1939	Multiple Foreign Keys breaks the admin	ww@…	nobody	"A minimal model that reproduces the problem:

{{{
class Account(models.Model):
	class Admin:
		pass
	owner = models.CharField(maxlength = 32)
	
class Transaction(models.Model):
	account = models.ForeignKey(Account, core = True, related_name = 'transactions1',
				    edit_inline = models.TABULAR,
				    num_in_admin = 1)
	contra = models.ForeignKey(Account, related_name = 'transactions2')
	description = models.CharField(maxlength = 64)
}}}

This code, when run in the admin, and when goes to the Account add screen, produces
the following traceback:

{{{
Traceback (most recent call last):
File ""/home/ww/django_src/django/template/__init__.py"" in render_node
  701. result = node.render(context)
File ""/home/ww/django_src/django/template/defaulttags.py"" in render
  113. nodelist.append(node.render(context))
File ""/home/ww/django_src/django/contrib/admin/templatetags/admin_modify.py"" in render
  155. bound_related_object = relation.bind(context['form'], original, bound_related_object_class)
File ""/home/ww/django_src/django/db/models/related.py"" in bind
  122. return bound_related_object_class(self, field_mapping, original)
File ""/home/ww/django_src/django/contrib/admin/templatetags/admin_modify.py"" in __init__
  136. self.form_field_collection_wrappers = [FormFieldCollectionWrapper(field_mapping ,fields, i)
File ""/home/ww/django_src/django/contrib/admin/templatetags/admin_modify.py"" in __init__
  112. self.bound_fields = [AdminBoundField(field, self.field_mapping, field_mapping['original'])
File ""/home/ww/django_src/django/contrib/admin/views/main.py"" in __init__
  115. self.form_fields = [field_mapping[name] for name in self.field.get_manipulator_field_names('')]
File ""/home/ww/django_src/django/forms/__init__.py"" in __getitem__
  195. return self.formfield_dict[template_key]

  KeyError at /admin/record/account/add/
  'account'
}}}

I am running SVN as of a few minutes ago."	defect	new	contrib.admin	dev	critical				Unreviewed	1	0	0	0	0	0
