Author: adrian
Date: 2006-07-31 23:05:25 -0500 (Mon, 31 Jul 2006)
New Revision: 3507
Modified:
django/trunk/django/db/models/fields/__init__.py
Log:
Fixed #2269 -- limit_choices_to now works properly with a custom
ForeignKey.to_field. Thanks for reporting, [EMAIL PROTECTED]
Modified: django/trunk/django/db/models/fields/__init__.py
===================================================================
--- django/trunk/django/db/models/fields/__init__.py 2006-08-01 02:57:08 UTC
(rev 3506)
+++ django/trunk/django/db/models/fields/__init__.py 2006-08-01 04:05:25 UTC
(rev 3507)
@@ -289,7 +289,7 @@
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):
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates
-~----------~----~----~----~------~----~------~--~---