| 66 | |
| 67 | |
| 68 | class UniquenessIntegerSerializer(serializers.Serializer): |
| 69 | # Note that this field *deliberately* does not correspond with the model field. |
| 70 | # This allows us to ensure that `ValueError`, `TypeError` or `DataError` etc |
| 71 | # raised by a uniqueness check does not trigger a deceptive "this field is not unique" |
| 72 | # validation failure. |
| 73 | integer = serializers.CharField(validators=[UniqueValidator(queryset=IntegerFieldModel.objects.all())]) |
| 74 | |
| 75 | |
| 76 | class TestUniquenessValidation(TestCase): |