Author: mtredinnick
Date: 2009-03-24 02:14:19 -0500 (Tue, 24 Mar 2009)
New Revision: 10140

Modified:
   django/branches/releases/1.0.X/django/contrib/admin/filterspecs.py
Log:
[1.0.X] Fixed #9994 -- Fixed admin filtering when to_field is used on relations.

Thanks to jzylks for diagnosing this one.

Backport of r10139 from trunk.

Modified: django/branches/releases/1.0.X/django/contrib/admin/filterspecs.py
===================================================================
--- django/branches/releases/1.0.X/django/contrib/admin/filterspecs.py  
2009-03-24 07:05:57 UTC (rev 10139)
+++ django/branches/releases/1.0.X/django/contrib/admin/filterspecs.py  
2009-03-24 07:14:19 UTC (rev 10140)
@@ -58,7 +58,8 @@
             self.lookup_title = f.rel.to._meta.verbose_name
         else:
             self.lookup_title = f.verbose_name
-        self.lookup_kwarg = '%s__%s__exact' % (f.name, f.rel.to._meta.pk.name)
+        rel_name = f.rel.get_related_field().name
+        self.lookup_kwarg = '%s__%s__exact' % (f.name, rel_name)
         self.lookup_val = request.GET.get(self.lookup_kwarg, None)
         self.lookup_choices = f.get_choices(include_blank=False)
 


--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to