Ticket #13171: field_subclassing_tests_patch.diff
File field_subclassing_tests_patch.diff, 1.3 KB (added by , 15 years ago) |
---|
-
tests/modeltests/field_subclassing/fields.py
41 41 def get_db_prep_save(self, value): 42 42 return unicode(value) 43 43 44 def get_ db_prep_lookup(self, lookup_type, value):44 def get_prep_lookup(self, lookup_type, value): 45 45 if lookup_type == 'exact': 46 46 return force_unicode(value) 47 47 if lookup_type == 'in': 48 48 return [force_unicode(v) for v in value] 49 49 if lookup_type == 'isnull': 50 50 return [] 51 raise FieldError('Invalid lookup type: %r' % lookup_type)51 raise TypeError('Invalid lookup type: %r' % lookup_type) 52 52 53 53 54 54 class JSONField(models.TextField): -
tests/modeltests/field_subclassing/models.py
51 51 >>> MyModel.objects.filter(data__lt=s) 52 52 Traceback (most recent call last): 53 53 ... 54 FieldError: Invalid lookup type: 'lt'54 TypeError: Invalid lookup type: 'lt' 55 55 56 56 # Serialization works, too. 57 57 >>> stream = serializers.serialize("json", MyModel.objects.all())