Ticket #2473: in_empty_list.diff

File in_empty_list.diff, 708 bytes (added by adurdin@…, 18 years ago)
  • django/db/models/query.py

     
    641641    except KeyError:
    642642        pass
    643643    if lookup_type == 'in':
    644         return '%s%s IN (%s)' % (table_prefix, field_name, ','.join(['%s' for v in value]))
     644        ids = list(value)
     645        if ids:
     646            return '%s%s IN (%s)' % (table_prefix, field_name, ','.join(['%s' for id in ids]))
     647        else:
     648            return '0'
    645649    elif lookup_type == 'range':
    646650        return '%s%s BETWEEN %%s AND %%s' % (table_prefix, field_name)
    647651    elif lookup_type in ('year', 'month', 'day'):
Back to Top