Fixed #423 -- Fixed bug in ForeignKey admin filters. Thanks, jkocherhans

git-svn-id: http://code.djangoproject.com/svn/django/trunk@569 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2005-08-26 21:12:06 +00:00
parent df3564dace
commit b77114caaa
1 changed files with 1 additions and 2 deletions

View File

@ -196,11 +196,10 @@ def change_list(request, app_label, module_name):
# Many-to-many or many-to-one filter. # Many-to-many or many-to-one filter.
if f.rel: if f.rel:
if isinstance(f, meta.ManyToManyField): if isinstance(f, meta.ManyToManyField):
lookup_kwarg = '%s__id__exact' % f.name
lookup_title = f.rel.to.verbose_name lookup_title = f.rel.to.verbose_name
else: else:
lookup_kwarg = '%s__exact' % f.name
lookup_title = f.verbose_name lookup_title = f.verbose_name
lookup_kwarg = '%s__id__exact' % f.name
lookup_val = request.GET.get(lookup_kwarg, None) lookup_val = request.GET.get(lookup_kwarg, None)
lookup_choices = f.rel.to.get_model_module().get_list() lookup_choices = f.rel.to.get_model_module().get_list()
if len(lookup_choices) > 1: if len(lookup_choices) > 1: