Fix typo in example Code

Fix a typo in the example showing how field level validation has been cleaned up.
This commit is contained in:
James Pulec 2014-11-07 15:07:06 -08:00
parent 7daeb5f782
commit 960ae8afd8

View File

@ -159,7 +159,7 @@ We strongly recommend that you use the namespaced import style of `import serial
The `validate_<field_name>` method hooks that can be attached to serializer classes change their signature slightly and return type. Previously these would take a dictionary of all incoming data, and a key representing the field name, and would return a dictionary including the validated data for that field:
def validate_score(self, attrs, source):
if attrs[score] % 10 != 0:
if attrs[source] % 10 != 0:
raise serializers.ValidationError('This field should be a multiple of ten.')
return attrs