Ticket #3096: 3096-filterspecs-2.patch

File 3096-filterspecs-2.patch, 606 bytes (added by Will Hardy, 17 years ago)

Take limit_choices_to into account for list_filter in Admin

  • filterspecs.py

     
    5858            self.lookup_title = f.verbose_name
    5959        self.lookup_kwarg = '%s__%s__exact' % (f.name, f.rel.to._meta.pk.name)
    6060        self.lookup_val = request.GET.get(self.lookup_kwarg, None)
    61         self.lookup_choices = f.rel.to._default_manager.all()
     61        self.lookup_choices = f.rel.to._default_manager.complex_filter(f.rel.limit_choices_to)
    6262
    6363    def has_output(self):
    6464        return len(self.lookup_choices) > 1
Back to Top