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. --- tests/admin_widgets/models.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/admin_widgets/models.py') diff --git a/tests/admin_widgets/models.py b/tests/admin_widgets/models.py index b111a7a517..c8e29dab8a 100644 --- a/tests/admin_widgets/models.py +++ b/tests/admin_widgets/models.py @@ -130,3 +130,11 @@ class School(models.Model): def __str__(self): return self.name + + +@python_2_unicode_compatible +class Profile(models.Model): + user = models.ForeignKey('auth.User', 'username') + + def __str__(self): + return self.user.username -- cgit v1.3