From dfab9af294972720f59890967cd9ae1a6c0796b6 Mon Sep 17 00:00:00 2001 From: Craig de Stigter Date: Fri, 3 Oct 2014 08:41:18 +1300 Subject: [PATCH 1/2] Minor: fix spelling and grammar, mostly in 3.0 announcement --- CONTRIBUTING.md | 2 +- docs/api-guide/fields.md | 2 +- docs/api-guide/renderers.md | 2 +- docs/topics/2.4-announcement.md | 2 +- docs/topics/3.0-announcement.md | 42 +++++++++++----------- docs/topics/contributing.md | 2 +- docs/topics/release-notes.md | 2 +- docs/topics/writable-nested-serializers.md | 2 +- rest_framework/compat.py | 2 +- rest_framework/fields.py | 12 +++---- rest_framework/relations.py | 2 +- rest_framework/validators.py | 2 +- rest_framework/views.py | 2 +- tests/test_model_serializer.py | 4 +-- tests/test_relations.py | 12 +++---- 15 files changed, 46 insertions(+), 46 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a6dd05a0e..1b1995348 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 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. diff --git a/docs/api-guide/fields.md b/docs/api-guide/fields.md index f07783186..292a51d89 100644 --- a/docs/api-guide/fields.md +++ b/docs/api-guide/fields.md @@ -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) -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) diff --git a/docs/api-guide/renderers.md b/docs/api-guide/renderers.md index 2e1c892fd..db7436c23 100644 --- a/docs/api-guide/renderers.md +++ b/docs/api-guide/renderers.md @@ -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. -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} diff --git a/docs/topics/2.4-announcement.md b/docs/topics/2.4-announcement.md index 09294b910..d8aa5b108 100644 --- a/docs/topics/2.4-announcement.md +++ b/docs/topics/2.4-announcement.md @@ -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. -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. diff --git a/docs/topics/3.0-announcement.md b/docs/topics/3.0-announcement.md index d2505a1b3..5242be573 100644 --- a/docs/topics/3.0-announcement.md +++ b/docs/topics/3.0-announcement.md @@ -6,10 +6,10 @@ The 3.0 release is now ready for some tentative testing and upgrades for super k See the [Version 3.0 GitHub issue](https://github.com/tomchristie/django-rest-framework/pull/1800) for more details on remaining work. -The most notable outstanding issues still to resolved on the `version-3.0` branch are as follows: +The most notable outstanding issues still to be resolved on the `version-3.0` branch are as follows: * Forms support for serializers and in the browsable API. -* Optimisations for serialializing primary keys. +* Optimisations for serializing primary keys. * Refine style of validation errors in some cases, such as validation errors in `ListField`. * `.transform_()` method on serializers. @@ -50,13 +50,13 @@ Below is an in-depth guide to the API changes and migration notes for 3.0. The usage of `request.DATA` and `request.FILES` is now discouraged in favor of a single `request.data` attribute that contains *all* the parsed data. -Having seperate attributes is reasonable for web applications that only ever parse URL encoded or MultiPart requests, but makes less sense for the general-purpose request parsing that REST framework supports. +Having separate attributes is reasonable for web applications that only ever parse URL encoded or MultiPart requests, but makes less sense for the general-purpose request parsing that REST framework supports. You may now pass all the request data to a serializer class in a single argument: ExampleSerializer(data=request.data) -Instead of passing the files argument seperately: +Instead of passing the files argument separately: # Don't do this... ExampleSerializer(data=request.DATA, files=request.FILES) @@ -75,7 +75,7 @@ Previously the serializers used a two-step object creation, as follows: This style is in line with how the `ModelForm` class works in Django, but is problematic for a number of reasons: -* Some data, such as many-to-many relationships, cannot be added to the object instance until after it has been saved. This type of data needed to be hidden in some undocumentated state on the object instance, or kept as state on the serializer instance so that it could be used when `.save()` is called. +* Some data, such as many-to-many relationships, cannot be added to the object instance until after it has been saved. This type of data needed to be hidden in some undocumented state on the object instance, or kept as state on the serializer instance so that it could be used when `.save()` is called. * Instantiating model instances directly means that you cannot use model manager classes for instance creation, eg `ExampleModel.objects.create(...)`. Manager classes are an excellent layer at which to enforce business logic and application-level data constraints. * The two step process makes it unclear where to put deserialization logic. For example, should extra attributes such as the current user get added to the instance during object creation or during object save? @@ -88,7 +88,7 @@ The resulting API changes are further detailed below. #### The `.create()` and `.update()` methods. -The `.restore_object()` method is now replaced with two seperate methods, `.create()` and `.update()`. +The `.restore_object()` method is now replaced with two separate methods, `.create()` and `.update()`. When using the `.create()` and `.update()` methods you should both create *and save* the object instance. This is in contrast to the previous `.restore_object()` behavior that would instantiate the object but not save it. @@ -107,7 +107,7 @@ The following example from the tutorial previously used `restore_object()` to ha # Create new instance return Snippet(**attrs) -This would now be split out into two seperate methods. +This would now be split out into two separate methods. def update(self, instance, validated_attrs) instance.title = validated_attrs.get('title', instance.title) @@ -146,7 +146,7 @@ The corresponding code would now look like this: #### Limitations of ModelSerializer validation. -This change also means that we no longer use the `.full_clean()` method on model instances, but instead perform all validation explicitly on the serializer. This gives a cleaner seperation, and ensures that there's no automatic validation behavior on `ModelSerializer` classes that can't also be easily replicated on regular `Serializer` classes. +This change also means that we no longer use the `.full_clean()` method on model instances, but instead perform all validation explicitly on the serializer. This gives a cleaner separation, and ensures that there's no automatic validation behavior on `ModelSerializer` classes that can't also be easily replicated on regular `Serializer` classes. This change comes with the following limitations: @@ -157,7 +157,7 @@ This change comes with the following limitations: REST framework 2.x attempted to automatically support writable nested serialization, but the behavior was complex and non-obvious. Attempting to automatically handle these case is problematic: -* There can be complex dependancies involved in order of saving multiple related model instances. +* There can be complex dependencies involved in order of saving multiple related model instances. * It's unclear what behavior the user should expect when related models are passed `None` data. * It's unclear how the user should expect to-many relationships to handle updates, creations and deletions of multiple records. @@ -289,7 +289,7 @@ The `ListSerializer` class has now been added, and allows you to create base ser class MultipleUserSerializer(ListSerializer): child = UserSerializer() -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 seperated in the REST framework codebase. +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. See also the new `ListField` class, which validates input in the same way, but does not include the serializer interfaces of `.is_valid()`, `.data`, `.save()` and so on. @@ -299,7 +299,7 @@ REST framework now includes a simple `BaseSerializer` class that can be used to This class implements the same basic API as the `Serializer` class: -* `.data` - Returns the outgoing primative representation. +* `.data` - Returns the outgoing primitive representation. * `.is_valid()` - Deserializes and validates incoming data. * `.validated_data` - Returns the validated incoming data. * `.errors` - Returns an errors during validation. @@ -320,7 +320,7 @@ To implement a read-only serializer using the `BaseSerializer` class, we just ne player_name = models.CharField(max_length=10) score = models.IntegerField() -It's simple to create a read-only serializer for converting `HighScore` instances into primative data types. +It's simple to create a read-only serializer for converting `HighScore` instances into primitive data types. class HighScoreSerializer(serializers.BaseSerializer): def to_representation(self, obj): @@ -394,12 +394,12 @@ Here's a complete example of our previous `HighScoreSerializer`, that's been upd 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. -The following class is an example of a generic serializer that can handle coercing aribitrary objects into primative representations. +The following class is an example of a generic serializer that can handle coercing aribitrary objects into primitive representations. class ObjectSerializer(serializers.BaseSerializer): """ A read-only serializer that coerces arbitrary complex objects - into primative representations. + into primitive representations. """ def to_representation(self, obj): for attribute_name in dir(obj): @@ -411,7 +411,7 @@ The following class is an example of a generic serializer that can handle coerci # Ignore methods and other callables. pass elif isinstance(attribute, (str, int, bool, float, type(None))): - # Primative types can be passed through unmodified. + # primitive types can be passed through unmodified. output[attribute_name] = attribute elif isinstance(attribute, list): # Recursivly deal with items in lists. @@ -437,7 +437,7 @@ There are some minor tweaks to the field base classes. Previously we had these two base classes: * `Field` as the base class for read-only fields. A default implementation was included for serializing data. -* `WriteableField` as the base class for read-write fields. +* `WritableField` as the base class for read-write fields. We now use the following: @@ -448,9 +448,9 @@ We now use the following: REST framework now has more explict and clear control over validating empty values for fields. -Previously the meaning of the `required=False` keyword argument was underspecified. In practice it's use meant that a field could either be not included in the input, or it could be included, but be `None`. +Previously the meaning of the `required=False` keyword argument was underspecified. In practice its use meant that a field could either be not included in the input, or it could be included, but be `None`. -We now have a better seperation, with seperate `required` and `allow_none` arguments. +We now have a better separation, with separate `required` and `allow_none` arguments. The following set of arguments are used to control validation of empty values: @@ -552,7 +552,7 @@ In order to ensure a consistent code style an assertion error will be raised if #### Enforcing consistent `source` usage. -I've see several codebases that unneccessarily include the `source` argument, setting it to the same value as the field name. This usage is redundant and confusing, making it less obvious that `source` is usually not required. +I've see several codebases that unnecessarily include the `source` argument, setting it to the same value as the field name. This usage is redundant and confusing, making it less obvious that `source` is usually not required. The following usage will *now raise an error*: @@ -614,7 +614,7 @@ I would personally recommend that developers treat view instances as immutable o #### PUT as create. -Allowing `PUT` as create operations is problematic, as it neccessarily exposes information about the existence or non-existance of objects. It's also not obvious that transparently allowing re-creating of previously deleted instances is neccessarily a better default behavior than simply returning `404` responses. +Allowing `PUT` as create operations is problematic, as it necessarily exposes information about the existence or non-existance of objects. It's also not obvious that transparently allowing re-creating of previously deleted instances is necessarily a better default behavior than simply returning `404` responses. Both styles "`PUT` as 404" and "`PUT` as create" can be valid in different circumstances, but we've now opted for the 404 behavior as the default, due to it being simpler and more obvious. @@ -628,7 +628,7 @@ This change means that you can now easily cusomize the style of error responses ## The metadata API -Behavior for dealing with `OPTIONS` requests was previously built directly into the class based views. This has now been properly seperated out into a Metadata API that allows the same pluggable style as other API policies in REST framework. +Behavior for dealing with `OPTIONS` requests was previously built directly into the class based views. This has now been properly separated out into a Metadata API that allows the same pluggable style as other API policies in REST framework. This makes it far easier to use a different style for `OPTIONS` responses throughout your API, and makes it possible to create third-party metadata policies. diff --git a/docs/topics/contributing.md b/docs/topics/contributing.md index 3400bc8f9..50b8ded16 100644 --- a/docs/topics/contributing.md +++ b/docs/topics/contributing.md @@ -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 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. diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md index 16589f3b9..4fa3d6271 100644 --- a/docs/topics/release-notes.md +++ b/docs/topics/release-notes.md @@ -149,7 +149,7 @@ You can determine your currently installed version using `pip freeze`: * Added `write_only_fields` option to `ModelSerializer` classes. * JSON renderer now deals with objects that implement a dict-like interface. * 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: Prevent double-escaping of non-latin1 URL query params when appending `format=json` params. diff --git a/docs/topics/writable-nested-serializers.md b/docs/topics/writable-nested-serializers.md index 66ea78150..abc6a82f7 100644 --- a/docs/topics/writable-nested-serializers.md +++ b/docs/topics/writable-nested-serializers.md @@ -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. -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 diff --git a/rest_framework/compat.py b/rest_framework/compat.py index 3993cee6d..e4e69580f 100644 --- a/rest_framework/compat.py +++ b/rest_framework/compat.py @@ -131,7 +131,7 @@ else: self.message = kwargs.pop('message', self.message) 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): from django.core.validators import URLValidator else: diff --git a/rest_framework/fields.py b/rest_framework/fields.py index f3ff22334..bba8ccae2 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -186,14 +186,14 @@ class Field(object): 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. """ return self.initial 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. """ if html.is_html_input(dictionary): @@ -205,7 +205,7 @@ class Field(object): 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. """ attribute = get_attribute(instance, self.source_attrs) @@ -274,13 +274,13 @@ class Field(object): 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.') 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.') @@ -928,7 +928,7 @@ class ImageField(FileField): def to_internal_value(self, data): # Image validation is a bit grungy, so we'll just outright # 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) django_field = self._DjangoImageField() django_field.error_messages = self.error_messages diff --git a/rest_framework/relations.py b/rest_framework/relations.py index 8c1356727..8141de134 100644 --- a/rest_framework/relations.py +++ b/rest_framework/relations.py @@ -100,7 +100,7 @@ class HyperlinkedRelatedField(RelatedField): self.lookup_url_kwarg = kwargs.pop('lookup_url_kwarg', self.lookup_field) 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 # implict `self` argument to be passed. self.reverse = reverse diff --git a/rest_framework/validators.py b/rest_framework/validators.py index 20de4b427..5bb69ad88 100644 --- a/rest_framework/validators.py +++ b/rest_framework/validators.py @@ -2,7 +2,7 @@ We perform uniqueness checks explicitly on the serializer class, rather 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 `ModelSerializer` class and an equivelent explicit `Serializer` class. """ diff --git a/rest_framework/views.py b/rest_framework/views.py index 835e223a7..979229eb4 100644 --- a/rest_framework/views.py +++ b/rest_framework/views.py @@ -100,7 +100,7 @@ class APIView(View): content_negotiation_class = api_settings.DEFAULT_CONTENT_NEGOTIATION_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 @classmethod diff --git a/tests/test_model_serializer.py b/tests/test_model_serializer.py index 2edf0be5b..bb74cd2e2 100644 --- a/tests/test_model_serializer.py +++ b/tests/test_model_serializer.py @@ -34,7 +34,7 @@ class RegularFieldsModel(models.Model): big_integer_field = models.BigIntegerField() boolean_field = models.BooleanField(default=False) 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() datetime_field = models.DateTimeField() decimal_field = models.DecimalField(max_digits=3, decimal_places=1) @@ -83,7 +83,7 @@ class TestRegularFieldMappings(TestCase): big_integer_field = IntegerField() boolean_field = BooleanField(required=False) char_field = CharField(max_length=100) - comma_seperated_integer_field = CharField(max_length=100, validators=[]) + comma_separated_integer_field = CharField(max_length=100, validators=[]) date_field = DateField() datetime_field = DateTimeField() decimal_field = DecimalField(decimal_places=1, max_digits=3) diff --git a/tests/test_relations.py b/tests/test_relations.py index 2d11672b8..66784195e 100644 --- a/tests/test_relations.py +++ b/tests/test_relations.py @@ -161,18 +161,18 @@ class TestSlugRelatedField(APISimpleTestCase): # https://github.com/tomchristie/django-rest-framework/issues/446 # """ # field = serializers.PrimaryKeyRelatedField(queryset=NullModel.objects.all()) -# self.assertRaises(serializers.ValidationError, field.to_primative, '') -# self.assertRaises(serializers.ValidationError, field.to_primative, []) +# self.assertRaises(serializers.ValidationError, field.to_primitive, '') +# self.assertRaises(serializers.ValidationError, field.to_primitive, []) # def test_hyperlinked_related_field_with_empty_string(self): # field = serializers.HyperlinkedRelatedField(queryset=NullModel.objects.all(), view_name='') -# self.assertRaises(serializers.ValidationError, field.to_primative, '') -# self.assertRaises(serializers.ValidationError, field.to_primative, []) +# self.assertRaises(serializers.ValidationError, field.to_primitive, '') +# self.assertRaises(serializers.ValidationError, field.to_primitive, []) # def test_slug_related_field_with_empty_string(self): # field = serializers.SlugRelatedField(queryset=NullModel.objects.all(), slug_field='pk') -# self.assertRaises(serializers.ValidationError, field.to_primative, '') -# self.assertRaises(serializers.ValidationError, field.to_primative, []) +# self.assertRaises(serializers.ValidationError, field.to_primitive, '') +# self.assertRaises(serializers.ValidationError, field.to_primitive, []) # class TestManyRelatedMixin(TestCase): From 857a8486b1534f89bd482de86d39ff717b6618eb Mon Sep 17 00:00:00 2001 From: Craig de Stigter Date: Fri, 3 Oct 2014 09:00:33 +1300 Subject: [PATCH 2/2] More spelling tweaks --- docs/topics/3.0-announcement.md | 6 +++--- rest_framework/filters.py | 2 +- rest_framework/mixins.py | 2 +- rest_framework/relations.py | 2 +- tests/test_response.py | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/topics/3.0-announcement.md b/docs/topics/3.0-announcement.md index 5242be573..fcae79e12 100644 --- a/docs/topics/3.0-announcement.md +++ b/docs/topics/3.0-announcement.md @@ -411,7 +411,7 @@ The following class is an example of a generic serializer that can handle coerci # Ignore methods and other callables. pass elif isinstance(attribute, (str, int, bool, float, type(None))): - # primitive types can be passed through unmodified. + # Primitive types can be passed through unmodified. output[attribute_name] = attribute elif isinstance(attribute, list): # Recursivly deal with items in lists. @@ -446,7 +446,7 @@ We now use the following: #### The `required`, `allow_none`, `allow_blank` and `default` arguments. -REST framework now has more explict and clear control over validating empty values for fields. +REST framework now has more explicit and clear control over validating empty values for fields. Previously the meaning of the `required=False` keyword argument was underspecified. In practice its use meant that a field could either be not included in the input, or it could be included, but be `None`. @@ -522,7 +522,7 @@ However this code *would not be valid* in `2.4.3`: # ... The queryset argument is now always required for writable relational fields. -This removes some magic and makes it easier and more obvious to move between implict `ModelSerializer` classes and explicit `Serializer` classes. +This removes some magic and makes it easier and more obvious to move between implicit `ModelSerializer` classes and explicit `Serializer` classes. class AccountSerializer(serializers.ModelSerializer): organisations = serializers.SlugRelatedField( diff --git a/rest_framework/filters.py b/rest_framework/filters.py index 4c485668a..d188a2d1e 100644 --- a/rest_framework/filters.py +++ b/rest_framework/filters.py @@ -148,7 +148,7 @@ class OrderingFilter(BaseFilterBackend): if not getattr(field, 'write_only', False) ] elif valid_fields == '__all__': - # View explictly allows filtering on any model field + # View explicitly allows filtering on any model field valid_fields = [field.name for field in queryset.model._meta.fields] valid_fields += queryset.query.aggregates.keys() diff --git a/rest_framework/mixins.py b/rest_framework/mixins.py index 04b7a7636..de334b4b9 100644 --- a/rest_framework/mixins.py +++ b/rest_framework/mixins.py @@ -83,7 +83,7 @@ class DestroyModelMixin(object): # The AllowPUTAsCreateMixin was previously the default behaviour -# for PUT requests. This has now been removed and must be *explictly* +# for PUT requests. This has now been removed and must be *explicitly* # included if it is the behavior that you want. # For more info see: ... diff --git a/rest_framework/relations.py b/rest_framework/relations.py index 8141de134..dc9781e7c 100644 --- a/rest_framework/relations.py +++ b/rest_framework/relations.py @@ -102,7 +102,7 @@ class HyperlinkedRelatedField(RelatedField): # We include these simply for dependency injection in tests. # We can't add them as class attributes or they would expect an - # implict `self` argument to be passed. + # implicit `self` argument to be passed. self.reverse = reverse self.resolve = resolve diff --git a/tests/test_response.py b/tests/test_response.py index 84c39c1a6..f233ae332 100644 --- a/tests/test_response.py +++ b/tests/test_response.py @@ -262,9 +262,9 @@ class Issue807Tests(TestCase): expected = "{0}; charset={1}".format(RendererC.media_type, RendererC.charset) self.assertEqual(expected, resp['Content-Type']) - def test_content_type_set_explictly_on_response(self): + def test_content_type_set_explicitly_on_response(self): """ - The content type may be set explictly on the response. + The content type may be set explicitly on the response. """ headers = {"HTTP_ACCEPT": RendererC.media_type} resp = self.client.get('/setbyview', **headers)