Ticket #3575: django_db2.diff

File django_db2.diff, 1.5 KB (added by Jack Moffitt <metajack@…>, 18 years ago)

additional patch to fix extra escaping for iexact queries

  • django/db/models/fields/__init__.py

     
    160160        "Returns field's value prepared for saving into a database."
    161161        return value
    162162
    163     def get_db_prep_lookup(self, lookup_type, value):
     163    def get_db_prep_lookup(self, lookup_type, value, skip_prep=False):
    164164        "Returns field's value prepared for database lookup."
    165         if lookup_type in ('exact', 'gt', 'gte', 'lt', 'lte', 'year', 'month', 'day', 'search'):
     165        if lookup_type in ('exact', 'gt', 'gte', 'lt', 'lte', 'year', 'month', 'day', 'search') or skip_prep:
    166166            return [value]
    167167        elif lookup_type in ('range', 'in'):
    168168            return value
  • django/db/models/query.py

     
    907907            column = field.column
    908908
    909909        where.append(get_where_clause(lookup_type, current_table + '.', column, value))
    910         params.extend(field.get_db_prep_lookup(lookup_type, value))
     910        if hasattr(backend, 'COLUMN_MAPPING') and backend.COLUMN_MAPPING.has_key(lookup_type):
     911            skip_prep = True
     912        else:
     913            skip_prep = False
     914        params.extend(field.get_db_prep_lookup(lookup_type, value, skip_prep))
    911915
    912916    return joins, where, params
    913917
Back to Top