Commit dfab9af2 by Craig de Stigter

Minor: fix spelling and grammar, mostly in 3.0 announcement

parent ffc6aa3a
...@@ -75,7 +75,7 @@ You can also use the excellent [`tox`][tox] testing tool to run the tests agains ...@@ -75,7 +75,7 @@ You can also use the excellent [`tox`][tox] testing tool to run the tests agains
It's a good idea to make pull requests early on. A pull request represents the start of a discussion, and doesn't necessarily need to be the final, finished submission. It's a good idea to make pull requests early on. A pull request represents the start of a discussion, and doesn't necessarily need to be the final, finished submission.
It's also always best to make a new branch before starting work on a pull request. This means that you'll be able to later switch back to working on another seperate issue without interfering with an ongoing pull requests. It's also always best to make a new branch before starting work on a pull request. This means that you'll be able to later switch back to working on another separate issue without interfering with an ongoing pull requests.
It's also useful to remember that if you have an outstanding pull request then pushing new commits to your GitHub repo will also automatically update the pull requests. It's also useful to remember that if you have an outstanding pull request then pushing new commits to your GitHub repo will also automatically update the pull requests.
......
...@@ -286,7 +286,7 @@ For example, to validate numbers up to 999 with a resolution of 2 decimal places ...@@ -286,7 +286,7 @@ For example, to validate numbers up to 999 with a resolution of 2 decimal places
serializers.DecimalField(max_digits=5, decimal_places=2) serializers.DecimalField(max_digits=5, decimal_places=2)
And to validate numbers up to anything lesss than one billion with a resolution of 10 decimal places: And to validate numbers up to anything less than one billion with a resolution of 10 decimal places:
serializers.DecimalField(max_digits=19, decimal_places=10) serializers.DecimalField(max_digits=19, decimal_places=10)
......
...@@ -74,7 +74,7 @@ If your API includes views that can serve both regular webpages and API response ...@@ -74,7 +74,7 @@ If your API includes views that can serve both regular webpages and API response
Renders the request data into `JSON`, using utf-8 encoding. Renders the request data into `JSON`, using utf-8 encoding.
Note that the default style is to include unicode characters, and render the response using a compact style with no uneccessary whitespace: Note that the default style is to include unicode characters, and render the response using a compact style with no unnecessary whitespace:
{"unicode black star":"★","value":999} {"unicode black star":"★","value":999}
......
...@@ -23,7 +23,7 @@ The documentation has previously stated that usage of the more explicit style is ...@@ -23,7 +23,7 @@ The documentation has previously stated that usage of the more explicit style is
Doing so will mean that there are cases of API code where you'll now need to include a serializer class where you previously were just using the `.model` shortcut. However we firmly believe that it is the right trade-off to make. Doing so will mean that there are cases of API code where you'll now need to include a serializer class where you previously were just using the `.model` shortcut. However we firmly believe that it is the right trade-off to make.
Removing the shortcut takes away an unneccessary layer of abstraction, and makes your codebase more explicit without any significant extra complexity. It also results in better consistency, as there's now only one way to set the serializer class and queryset attributes for the view, instead of two. Removing the shortcut takes away an unnecessary layer of abstraction, and makes your codebase more explicit without any significant extra complexity. It also results in better consistency, as there's now only one way to set the serializer class and queryset attributes for the view, instead of two.
The `DEFAULT_MODEL_SERIALIZER_CLASS` API setting is now also deprecated. The `DEFAULT_MODEL_SERIALIZER_CLASS` API setting is now also deprecated.
......
...@@ -109,7 +109,7 @@ You can also use the excellent [tox][tox] testing tool to run the tests against ...@@ -109,7 +109,7 @@ You can also use the excellent [tox][tox] testing tool to run the tests against
It's a good idea to make pull requests early on. A pull request represents the start of a discussion, and doesn't necessarily need to be the final, finished submission. It's a good idea to make pull requests early on. A pull request represents the start of a discussion, and doesn't necessarily need to be the final, finished submission.
It's also always best to make a new branch before starting work on a pull request. This means that you'll be able to later switch back to working on another seperate issue without interfering with an ongoing pull requests. It's also always best to make a new branch before starting work on a pull request. This means that you'll be able to later switch back to working on another separate issue without interfering with an ongoing pull requests.
It's also useful to remember that if you have an outstanding pull request then pushing new commits to your GitHub repo will also automatically update the pull requests. It's also useful to remember that if you have an outstanding pull request then pushing new commits to your GitHub repo will also automatically update the pull requests.
......
...@@ -149,7 +149,7 @@ You can determine your currently installed version using `pip freeze`: ...@@ -149,7 +149,7 @@ You can determine your currently installed version using `pip freeze`:
* Added `write_only_fields` option to `ModelSerializer` classes. * Added `write_only_fields` option to `ModelSerializer` classes.
* JSON renderer now deals with objects that implement a dict-like interface. * JSON renderer now deals with objects that implement a dict-like interface.
* Fix compatiblity with newer versions of `django-oauth-plus`. * Fix compatiblity with newer versions of `django-oauth-plus`.
* Bugfix: Refine behavior that calls model manager `all()` across nested serializer relationships, preventing erronous behavior with some non-ORM objects, and preventing unneccessary queryset re-evaluations. * Bugfix: Refine behavior that calls model manager `all()` across nested serializer relationships, preventing erronous behavior with some non-ORM objects, and preventing unnecessary queryset re-evaluations.
* Bugfix: Allow defaults on BooleanFields to be properly honored when values are not supplied. * Bugfix: Allow defaults on BooleanFields to be properly honored when values are not supplied.
* Bugfix: Prevent double-escaping of non-latin1 URL query params when appending `format=json` params. * Bugfix: Prevent double-escaping of non-latin1 URL query params when appending `format=json` params.
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
Although flat data structures serve to properly delineate between the individual entities in your service, there are cases where it may be more appropriate or convenient to use nested data structures. Although flat data structures serve to properly delineate between the individual entities in your service, there are cases where it may be more appropriate or convenient to use nested data structures.
Nested data structures are easy enough to work with if they're read-only - simply nest your serializer classes and you're good to go. However, there are a few more subtleties to using writable nested serializers, due to the dependancies between the various model instances, and the need to save or delete multiple instances in a single action. Nested data structures are easy enough to work with if they're read-only - simply nest your serializer classes and you're good to go. However, there are a few more subtleties to using writable nested serializers, due to the dependencies between the various model instances, and the need to save or delete multiple instances in a single action.
## One-to-many data structures ## One-to-many data structures
......
...@@ -131,7 +131,7 @@ else: ...@@ -131,7 +131,7 @@ else:
self.message = kwargs.pop('message', self.message) self.message = kwargs.pop('message', self.message)
super(MaxValueValidator, self).__init__(*args, **kwargs) super(MaxValueValidator, self).__init__(*args, **kwargs)
# URLValidator only accept `message` in 1.6+ # URLValidator only accepts `message` in 1.6+
if django.VERSION >= (1, 6): if django.VERSION >= (1, 6):
from django.core.validators import URLValidator from django.core.validators import URLValidator
else: else:
......
...@@ -186,14 +186,14 @@ class Field(object): ...@@ -186,14 +186,14 @@ class Field(object):
def get_initial(self): def get_initial(self):
""" """
Return a value to use when the field is being returned as a primative Return a value to use when the field is being returned as a primitive
value, without any object instance. value, without any object instance.
""" """
return self.initial return self.initial
def get_value(self, dictionary): def get_value(self, dictionary):
""" """
Given the *incoming* primative data, return the value for this field Given the *incoming* primitive data, return the value for this field
that should be validated and transformed to a native value. that should be validated and transformed to a native value.
""" """
if html.is_html_input(dictionary): if html.is_html_input(dictionary):
...@@ -205,7 +205,7 @@ class Field(object): ...@@ -205,7 +205,7 @@ class Field(object):
def get_field_representation(self, instance): def get_field_representation(self, instance):
""" """
Given the outgoing object instance, return the primative value Given the outgoing object instance, return the primitive value
that should be used for this field. that should be used for this field.
""" """
attribute = get_attribute(instance, self.source_attrs) attribute = get_attribute(instance, self.source_attrs)
...@@ -274,13 +274,13 @@ class Field(object): ...@@ -274,13 +274,13 @@ class Field(object):
def to_internal_value(self, data): def to_internal_value(self, data):
""" """
Transform the *incoming* primative data into a native value. Transform the *incoming* primitive data into a native value.
""" """
raise NotImplementedError('to_internal_value() must be implemented.') raise NotImplementedError('to_internal_value() must be implemented.')
def to_representation(self, value): def to_representation(self, value):
""" """
Transform the *outgoing* native value into primative data. Transform the *outgoing* native value into primitive data.
""" """
raise NotImplementedError('to_representation() must be implemented.') raise NotImplementedError('to_representation() must be implemented.')
...@@ -928,7 +928,7 @@ class ImageField(FileField): ...@@ -928,7 +928,7 @@ class ImageField(FileField):
def to_internal_value(self, data): def to_internal_value(self, data):
# Image validation is a bit grungy, so we'll just outright # Image validation is a bit grungy, so we'll just outright
# defer to Django's implementation so we don't need to # defer to Django's implementation so we don't need to
# consider it, or treat PIL as a test dependancy. # consider it, or treat PIL as a test dependency.
file_object = super(ImageField, self).to_internal_value(data) file_object = super(ImageField, self).to_internal_value(data)
django_field = self._DjangoImageField() django_field = self._DjangoImageField()
django_field.error_messages = self.error_messages django_field.error_messages = self.error_messages
......
...@@ -100,7 +100,7 @@ class HyperlinkedRelatedField(RelatedField): ...@@ -100,7 +100,7 @@ class HyperlinkedRelatedField(RelatedField):
self.lookup_url_kwarg = kwargs.pop('lookup_url_kwarg', self.lookup_field) self.lookup_url_kwarg = kwargs.pop('lookup_url_kwarg', self.lookup_field)
self.format = kwargs.pop('format', None) self.format = kwargs.pop('format', None)
# We include these simply for dependancy injection in tests. # We include these simply for dependency injection in tests.
# We can't add them as class attributes or they would expect an # We can't add them as class attributes or they would expect an
# implict `self` argument to be passed. # implict `self` argument to be passed.
self.reverse = reverse self.reverse = reverse
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
We perform uniqueness checks explicitly on the serializer class, rather We perform uniqueness checks explicitly on the serializer class, rather
the using Django's `.full_clean()`. the using Django's `.full_clean()`.
This gives us better seperation of concerns, allows us to use single-step This gives us better separation of concerns, allows us to use single-step
object creation, and makes it possible to switch between using the implicit object creation, and makes it possible to switch between using the implicit
`ModelSerializer` class and an equivelent explicit `Serializer` class. `ModelSerializer` class and an equivelent explicit `Serializer` class.
""" """
......
...@@ -100,7 +100,7 @@ class APIView(View): ...@@ -100,7 +100,7 @@ class APIView(View):
content_negotiation_class = api_settings.DEFAULT_CONTENT_NEGOTIATION_CLASS content_negotiation_class = api_settings.DEFAULT_CONTENT_NEGOTIATION_CLASS
metadata_class = api_settings.DEFAULT_METADATA_CLASS metadata_class = api_settings.DEFAULT_METADATA_CLASS
# Allow dependancy injection of other settings to make testing easier. # Allow dependency injection of other settings to make testing easier.
settings = api_settings settings = api_settings
@classmethod @classmethod
......
...@@ -34,7 +34,7 @@ class RegularFieldsModel(models.Model): ...@@ -34,7 +34,7 @@ class RegularFieldsModel(models.Model):
big_integer_field = models.BigIntegerField() big_integer_field = models.BigIntegerField()
boolean_field = models.BooleanField(default=False) boolean_field = models.BooleanField(default=False)
char_field = models.CharField(max_length=100) char_field = models.CharField(max_length=100)
comma_seperated_integer_field = models.CommaSeparatedIntegerField(max_length=100) comma_separated_integer_field = models.CommaSeparatedIntegerField(max_length=100)
date_field = models.DateField() date_field = models.DateField()
datetime_field = models.DateTimeField() datetime_field = models.DateTimeField()
decimal_field = models.DecimalField(max_digits=3, decimal_places=1) decimal_field = models.DecimalField(max_digits=3, decimal_places=1)
...@@ -83,7 +83,7 @@ class TestRegularFieldMappings(TestCase): ...@@ -83,7 +83,7 @@ class TestRegularFieldMappings(TestCase):
big_integer_field = IntegerField() big_integer_field = IntegerField()
boolean_field = BooleanField(required=False) boolean_field = BooleanField(required=False)
char_field = CharField(max_length=100) char_field = CharField(max_length=100)
comma_seperated_integer_field = CharField(max_length=100, validators=[<django.core.validators.RegexValidator object>]) comma_separated_integer_field = CharField(max_length=100, validators=[<django.core.validators.RegexValidator object>])
date_field = DateField() date_field = DateField()
datetime_field = DateTimeField() datetime_field = DateTimeField()
decimal_field = DecimalField(decimal_places=1, max_digits=3) decimal_field = DecimalField(decimal_places=1, max_digits=3)
......
...@@ -161,18 +161,18 @@ class TestSlugRelatedField(APISimpleTestCase): ...@@ -161,18 +161,18 @@ class TestSlugRelatedField(APISimpleTestCase):
# https://github.com/tomchristie/django-rest-framework/issues/446 # https://github.com/tomchristie/django-rest-framework/issues/446
# """ # """
# field = serializers.PrimaryKeyRelatedField(queryset=NullModel.objects.all()) # field = serializers.PrimaryKeyRelatedField(queryset=NullModel.objects.all())
# self.assertRaises(serializers.ValidationError, field.to_primative, '') # self.assertRaises(serializers.ValidationError, field.to_primitive, '')
# self.assertRaises(serializers.ValidationError, field.to_primative, []) # self.assertRaises(serializers.ValidationError, field.to_primitive, [])
# def test_hyperlinked_related_field_with_empty_string(self): # def test_hyperlinked_related_field_with_empty_string(self):
# field = serializers.HyperlinkedRelatedField(queryset=NullModel.objects.all(), view_name='') # field = serializers.HyperlinkedRelatedField(queryset=NullModel.objects.all(), view_name='')
# self.assertRaises(serializers.ValidationError, field.to_primative, '') # self.assertRaises(serializers.ValidationError, field.to_primitive, '')
# self.assertRaises(serializers.ValidationError, field.to_primative, []) # self.assertRaises(serializers.ValidationError, field.to_primitive, [])
# def test_slug_related_field_with_empty_string(self): # def test_slug_related_field_with_empty_string(self):
# field = serializers.SlugRelatedField(queryset=NullModel.objects.all(), slug_field='pk') # field = serializers.SlugRelatedField(queryset=NullModel.objects.all(), slug_field='pk')
# self.assertRaises(serializers.ValidationError, field.to_primative, '') # self.assertRaises(serializers.ValidationError, field.to_primitive, '')
# self.assertRaises(serializers.ValidationError, field.to_primative, []) # self.assertRaises(serializers.ValidationError, field.to_primitive, [])
# class TestManyRelatedMixin(TestCase): # class TestManyRelatedMixin(TestCase):
......
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