Ticket #2192: datefield_unique.2.diff

File datefield_unique.2.diff, 644 bytes (added by deryck@…, 18 years ago)

New version of patch. Just check for string first, rather than convert to object, only to go back to string.

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

     
    411411    def get_db_prep_lookup(self, lookup_type, value):
    412412        if lookup_type == 'range':
    413413            value = [str(v) for v in value]
    414         elif lookup_type in ('exact', 'gt', 'gte', 'lt', 'lte', 'ne'):
     414        elif type(value) is not str and lookup_type in ('exact', 'gt', 'gte', 'lt', 'lte', 'ne'):
    415415            value = value.strftime('%Y-%m-%d')
    416416        else:
    417417            value = str(value)
Back to Top