summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2006-08-01 04:05:25 +0000
committerAdrian Holovaty <adrian@holovaty.com>2006-08-01 04:05:25 +0000
commit97e820ab3a71c65a39d8ce2539735dc9c73b5cec (patch)
treeea2dbf8b72cce026bbf5805d0baeede7bf93e260 /django
parent1a428ec9b8efd24b0ced665d348160a9fd396c42 (diff)
Fixed #2269 -- limit_choices_to now works properly with a custom ForeignKey.to_field. Thanks for reporting, mir@noris.de
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3507 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/db/models/fields/__init__.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py
index 516f4b1538..f19374f08c 100644
--- a/django/db/models/fields/__init__.py
+++ b/django/db/models/fields/__init__.py
@@ -289,7 +289,7 @@ class Field(object):
if self.choices:
return first_choice + list(self.choices)
rel_model = self.rel.to
- return first_choice + [(x._get_pk_val(), str(x))
+ return first_choice + [(getattr(x, self.rel.get_related_field().attname), str(x))
for x in rel_model._default_manager.complex_filter(self.rel.limit_choices_to)]
def get_choices_default(self):