summaryrefslogtreecommitdiff
path: root/tests/admin_widgets/models.py
diff options
context:
space:
mode:
authorJulien Phalip <jphalip@gmail.com>2013-09-07 11:52:14 -0500
committerJulien Phalip <jphalip@gmail.com>2013-09-07 12:14:07 -0500
commit55a11683f7b094ae4fd0b9fa030d18a12657ba98 (patch)
treed40eb5bca9ffdfb9995419bbd74ce0f77f42a3a7 /tests/admin_widgets/models.py
parent4e784f337c4f8ec14e8ea3615fe79f033699e348 (diff)
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.
Diffstat (limited to 'tests/admin_widgets/models.py')
-rw-r--r--tests/admin_widgets/models.py8
1 files changed, 8 insertions, 0 deletions
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