Commit b39bd7ce by Tom Christie

Merge pull request #2127 from marctc/patch-1

Missing quotes on validate_score example
parents 06fd63da 83e556ba
...@@ -170,7 +170,7 @@ We strongly recommend that you use the namespaced import style of `import serial ...@@ -170,7 +170,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: 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): def validate_score(self, attrs, source):
if attrs[score] % 10 != 0: if attrs['score'] % 10 != 0:
raise serializers.ValidationError('This field should be a multiple of ten.') raise serializers.ValidationError('This field should be a multiple of ten.')
return attrs return attrs
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment