From 55a11683f7b094ae4fd0b9fa030d18a12657ba98 Mon Sep 17 00:00:00 2001 From: Julien Phalip Date: Sat, 7 Sep 2013 11:52:14 -0500 Subject: Fixed #20836 -- Ensure that the ForeignKey's to_field attribute is properly considered by the admin's interface when creating related objects. Many thanks to Collin Anderson for the report and patch and to Peter Sheats for the test. --- django/contrib/admin/options.py | 18 ++++++++++++++++-- django/contrib/admin/templates/admin/change_form.html | 3 ++- django/contrib/admin/templates/admin/change_list.html | 2 +- .../contrib/admin/templates/admin/popup_response.html | 2 +- django/contrib/admin/templatetags/admin_urls.py | 5 ++++- django/contrib/admin/views/main.py | 3 +-- django/contrib/admin/widgets.py | 6 ++++-- 7 files changed, 29 insertions(+), 10 deletions(-) (limited to 'django') diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py index 72c3635b52..f53d655bfc 100644 --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -44,6 +44,7 @@ from django.views.decorators.csrf import csrf_protect IS_POPUP_VAR = '_popup' +TO_FIELD_VAR = '_to_field' HORIZONTAL, VERTICAL = 1, 2 # returns the