Ticket #7707: 7707.diff
File 7707.diff, 1.6 KB (added by , 16 years ago) |
---|
-
django/db/models/fields/__init__.py
554 554 raise validators.ValidationError, _('Enter a valid date in YYYY-MM-DD format.') 555 555 556 556 def get_db_prep_lookup(self, lookup_type, value): 557 if lookup_type == 'range':557 if lookup_type in ('range', 'in'): 558 558 value = [smart_unicode(v) for v in value] 559 559 elif lookup_type in ('exact', 'gt', 'gte', 'lt', 'lte') and hasattr(value, 'strftime'): 560 560 value = value.strftime('%Y-%m-%d') … … 641 641 return Field.get_db_prep_save(self, value) 642 642 643 643 def get_db_prep_lookup(self, lookup_type, value): 644 if lookup_type == 'range':644 if lookup_type in ('range', 'in'): 645 645 value = [smart_unicode(v) for v in value] 646 646 else: 647 647 value = smart_unicode(value) -
tests/modeltests/lookup/models.py
192 192 ... 193 193 TypeError: 'flat' is not valid when values_list is called with more than one field. 194 194 195 196 # DateTimeField `in` lookups 197 >>> Article.objects.filter(pub_date__in=[datetime(2005, 7, 26), datetime(2005, 7, 28)]) 198 [<Article: Article 4>, <Article: Article 1>] 199 195 200 # Every DateField and DateTimeField creates get_next_by_FOO() and 196 201 # get_previous_by_FOO() methods. 197 202 # In the case of identical date values, these methods will use the ID as a