Ticket #3096: 3096-get_choices.diff
File 3096-get_choices.diff, 1.2 KB (added by , 16 years ago) |
---|
-
django/contrib/admin/filterspecs.py
60 60 self.lookup_title = f.verbose_name 61 61 self.lookup_kwarg = '%s__%s__exact' % (f.name, f.rel.to._meta.pk.name) 62 62 self.lookup_val = request.GET.get(self.lookup_kwarg, None) 63 self.lookup_choices = f. rel.to._default_manager.all()63 self.lookup_choices = f.get_choices(include_blank=False) 64 64 65 65 def has_output(self): 66 66 return len(self.lookup_choices) > 1 … … 72 72 yield {'selected': self.lookup_val is None, 73 73 'query_string': cl.get_query_string({}, [self.lookup_kwarg]), 74 74 'display': _('All')} 75 for val in self.lookup_choices: 76 pk_val = getattr(val, self.field.rel.to._meta.pk.attname) 75 for pk_val, val in self.lookup_choices: 77 76 yield {'selected': self.lookup_val == smart_unicode(pk_val), 78 77 'query_string': cl.get_query_string({self.lookup_kwarg: pk_val}), 79 78 'display': val}