Skip to content

Commit 5cad60d

Browse files
committed
Merge pull request #2115 from hgiasac/master
Fix typo "serailizers" to "serializers"
2 parents f7de442 + c94d1e6 commit 5cad60d

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

docs/topics/3.0-announcement.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -189,13 +189,13 @@ You can either return `non_field_errors` from the validate method by raising a s
189189

190190
def validate(self, attrs):
191191
# serializer.errors == {'non_field_errors': ['A non field error']}
192-
raise serailizers.ValidationError('A non field error')
192+
raise serializers.ValidationError('A non field error')
193193

194194
Alternatively if you want the errors to be against a specific field, use a dictionary of when instantiating the `ValidationError`, like so:
195195

196196
def validate(self, attrs):
197197
# serializer.errors == {'my_field': ['A field error']}
198-
raise serailizers.ValidationError({'my_field': 'A field error'})
198+
raise serializers.ValidationError({'my_field': 'A field error'})
199199

200200
This ensures you can still write validation that compares all the input fields, but that marks the error against a particular field.
201201

@@ -303,7 +303,7 @@ Alternatively, specify the field explicitly on the serializer class:
303303
model = MyModel
304304
fields = ('id', 'email', 'notes', 'is_admin')
305305

306-
The `read_only_fields` option remains as a convenient shortcut for the more common case.
306+
The `read_only_fields` option remains as a convenient shortcut for the more common case.
307307

308308
#### Changes to `HyperlinkedModelSerializer`.
309309

@@ -364,7 +364,7 @@ The `ListSerializer` class has now been added, and allows you to create base ser
364364
class MultipleUserSerializer(ListSerializer):
365365
child = UserSerializer()
366366

367-
You can also still use the `many=True` argument to serializer classes. It's worth noting that `many=True` argument transparently creates a `ListSerializer` instance, allowing the validation logic for list and non-list data to be cleanly separated in the REST framework codebase.
367+
You can also still use the `many=True` argument to serializer classes. It's worth noting that `many=True` argument transparently creates a `ListSerializer` instance, allowing the validation logic for list and non-list data to be cleanly separated in the REST framework codebase.
368368

369369
You will typically want to *continue to use the existing `many=True` flag* rather than declaring `ListSerializer` classes explicitly, but declaring the classes explicitly can be useful if you need to write custom `create` or `update` methods for bulk updates, or provide for other custom behavior.
370370

@@ -436,7 +436,7 @@ Here's a complete example of our previous `HighScoreSerializer`, that's been upd
436436
def to_internal_value(self, data):
437437
score = data.get('score')
438438
player_name = data.get('player_name')
439-
439+
440440
# Perform the data validation.
441441
if not score:
442442
raise ValidationError({
@@ -450,7 +450,7 @@ Here's a complete example of our previous `HighScoreSerializer`, that's been upd
450450
raise ValidationError({
451451
'player_name': 'May not be more than 10 characters.'
452452
})
453-
453+
454454
# Return the validated values. This will be available as
455455
# the `.validated_data` property.
456456
return {
@@ -463,15 +463,15 @@ Here's a complete example of our previous `HighScoreSerializer`, that's been upd
463463
'score': obj.score,
464464
'player_name': obj.player_name
465465
}
466-
466+
467467
def create(self, validated_data):
468468
return HighScore.objects.create(**validated_data)
469469

470470
#### Creating new generic serializers with `BaseSerializer`.
471471

472472
The `BaseSerializer` class is also useful if you want to implement new generic serializer classes for dealing with particular serialization styles, or for integrating with alternative storage backends.
473473

474-
The following class is an example of a generic serializer that can handle coercing aribitrary objects into primitive representations.
474+
The following class is an example of a generic serializer that can handle coercing aribitrary objects into primitive representations.
475475

476476
class ObjectSerializer(serializers.BaseSerializer):
477477
"""
@@ -542,7 +542,7 @@ The `default` argument is also available and always implies that the field is no
542542

543543
#### Coercing output types.
544544

545-
The previous field implementations did not forcibly coerce returned values into the correct type in many cases. For example, an `IntegerField` would return a string output if the attribute value was a string. We now more strictly coerce to the correct return type, leading to more constrained and expected behavior.
545+
The previous field implementations did not forcibly coerce returned values into the correct type in many cases. For example, an `IntegerField` would return a string output if the attribute value was a string. We now more strictly coerce to the correct return type, leading to more constrained and expected behavior.
546546

547547
#### The `ListField` class.
548548

@@ -695,7 +695,7 @@ These classes are documented in the [Validators](../api-guide/validators.md) sec
695695

696696
The view logic for the default method handlers has been significantly simplified, due to the new serializers API.
697697

698-
#### Changes to pre/post save hooks.
698+
#### Changes to pre/post save hooks.
699699

700700
The `pre_save` and `post_save` hooks no longer exist, but are replaced with `perform_create(self, serializer)` and `perform_update(self, serializer)`.
701701

@@ -887,4 +887,4 @@ The 3.2 release is planned to introduce an alternative admin-style interface to
887887

888888
You can follow development on the GitHub site, where we use [milestones to indicate planning timescales](https://github.com/tomchristie/django-rest-framework/milestones).
889889

890-
[mixins.py]: https://github.com/tomchristie/django-rest-framework/blob/master/rest_framework/mixins.py
890+
[mixins.py]: https://github.com/tomchristie/django-rest-framework/blob/master/rest_framework/mixins.py

0 commit comments

Comments
 (0)