Ticket #7881: raw_id_limit_choices_admin.diff

File raw_id_limit_choices_admin.diff, 1.3 KB (added by James Turk, 16 years ago)

small patches admin/views/main.py and admin/widgets.py fix this issue

  • django/contrib/admin/views/main.py

     
    179179                del lookup_params[key]
    180180                lookup_params[smart_str(key)] = value
    181181
     182            # if key ends with __in, split parameter into separate values
     183            if key.endswith('__in'):
     184                lookup_params[key] = value.split(',')
     185
    182186        # Apply lookup parameters from the query string.
    183187        qs = qs.filter(**lookup_params)
    184188
  • django/contrib/admin/widgets.py

     
    102102    def render(self, name, value, attrs=None):
    103103        related_url = '../../../%s/%s/' % (self.rel.to._meta.app_label, self.rel.to._meta.object_name.lower())
    104104        if self.rel.limit_choices_to:
    105             url = '?' + '&'.join(['%s=%s' % (k, v) for k, v in self.rel.limit_choices_to.items()])
     105            url = '?' + '&'.join(['%s=%s' % (k, ','.join(v)) for k, v in self.rel.limit_choices_to.items()])
    106106        else:
    107107            url = ''
    108108        if not attrs.has_key('class'):
Back to Top