Ticket #2192: datefield_unique.diff

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

Convert string to datetime.date in DateField.get_db_prep_lookup if needed.

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

     
    412412        if lookup_type == 'range':
    413413            value = [str(v) for v in value]
    414414        elif lookup_type in ('exact', 'gt', 'gte', 'lt', 'lte', 'ne'):
     415            if type(value) is str:
     416                value = self.to_python(value)
    415417            value = value.strftime('%Y-%m-%d')
    416418        else:
    417419            value = str(value)
Back to Top