diff --git a/.travis.yml b/.travis.yml index 100a7cd8b..cd87dd339 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,44 +1,51 @@ language: python python: + - "2.7" + - "3.4" - "3.5" sudo: false env: - - TOX_ENV=py27-lint - - TOX_ENV=py27-docs - - TOX_ENV=py35-django19 - - TOX_ENV=py34-django19 - - TOX_ENV=py27-django19 - - TOX_ENV=py35-django18 - - TOX_ENV=py34-django18 - - TOX_ENV=py33-django18 - - TOX_ENV=py27-django18 - - TOX_ENV=py27-django110 - - TOX_ENV=py35-django110 - - TOX_ENV=py34-django110 - - TOX_ENV=py27-djangomaster - - TOX_ENV=py34-djangomaster - - TOX_ENV=py35-djangomaster + - DJANGO=1.8 + - DJANGO=1.9 + - DJANGO=1.10 + - DJANGO=1.11 + - DJANGO=master matrix: fast_finish: true + include: + - python: "3.6" + env: DJANGO=master + - python: "3.6" + env: DJANGO=1.11 + - python: "3.3" + env: DJANGO=1.8 + - python: "2.7" + env: TOXENV="lint" + - python: "2.7" + env: TOXENV="docs" + exclude: + - python: "2.7" + env: DJANGO=master + - python: "3.4" + env: DJANGO=master + allow_failures: - - env: TOX_ENV=py27-djangomaster - - env: TOX_ENV=py34-djangomaster - - env: TOX_ENV=py35-djangomaster + - env: DJANGO=master + - env: DJANGO=1.11 install: - # Virtualenv < 14 is required to keep the Python 3.2 builds running. - - pip install tox "virtualenv<14" + - pip install tox tox-travis script: - - tox -e $TOX_ENV + - tox after_success: - pip install codecov - - codecov -e TOX_ENV + - codecov -e TOXENV,DJANGO notifications: email: false diff --git a/README.md b/README.md index 7bf90ba6a..609f99184 100644 --- a/README.md +++ b/README.md @@ -24,10 +24,11 @@ The initial aim is to provide a single full-time position on REST framework. - + +

-*Many thanks to all our [wonderful sponsors][sponsors], and in particular to our premium backers, [Rover](http://jobs.rover.com/), [Sentry](https://getsentry.com/welcome/), [Stream](https://getstream.io/?utm_source=drf&utm_medium=banner&utm_campaign=drf), and [Machinalis](http://www.machinalis.com/#services).* +*Many thanks to all our [wonderful sponsors][sponsors], and in particular to our premium backers, [Rover](http://jobs.rover.com/), [Sentry](https://getsentry.com/welcome/), [Stream](https://getstream.io/?utm_source=drf&utm_medium=banner&utm_campaign=drf), [Machinalis](https://hello.machinalis.co.uk/), and [Rollbar](https://rollbar.com).* --- diff --git a/docs/api-guide/fields.md b/docs/api-guide/fields.md index b527b016b..22ce7dd77 100644 --- a/docs/api-guide/fields.md +++ b/docs/api-guide/fields.md @@ -434,9 +434,11 @@ Requires either the `Pillow` package or `PIL` package. The `Pillow` package is A field class that validates a list of objects. -**Signature**: `ListField(child)` +**Signature**: `ListField(child, min_length=None, max_length=None)` - `child` - A field instance that should be used for validating the objects in the list. If this argument is not provided then objects in the list will not be validated. +- `min_length` - Validates that the list contains no fewer than this number of elements. +- `max_length` - Validates that the list contains no more than this number of elements. For example, to validate a list of integers you might use something like the following: diff --git a/docs/api-guide/metadata.md b/docs/api-guide/metadata.md index e98a9a311..de28ffd8a 100644 --- a/docs/api-guide/metadata.md +++ b/docs/api-guide/metadata.md @@ -113,7 +113,7 @@ The following third party packages provide additional metadata implementations. [drf-schema-adapter][drf-schema-adapter] is a set of tools that makes it easier to provide schema information to frontend frameworks and libraries. It provides a metadata mixin as well as 2 metadata classes and several adapters suitable to generate [json-schema][json-schema] as well as schema information readable by various libraries. You can also write your own adapter to work with your specific frontend. -If you whish to do so, it also provides an exporter that can export those schema information to json files. +If you wish to do so, it also provides an exporter that can export those schema information to json files. [cite]: http://tools.ietf.org/html/rfc7231#section-4.3.7 [no-options]: https://www.mnot.net/blog/2012/10/29/NO_OPTIONS diff --git a/docs/api-guide/permissions.md b/docs/api-guide/permissions.md index be2981327..548b14438 100644 --- a/docs/api-guide/permissions.md +++ b/docs/api-guide/permissions.md @@ -259,12 +259,16 @@ The [REST Condition][rest-condition] package is another extension for building c ## DRY Rest Permissions -The [DRY Rest Permissions][dry-rest-permissions] package provides the ability to define different permissions for individual default and custom actions. This package is made for apps with permissions that are derived from relationships defined in the app's data model. It also supports permission checks being returned to a client app through the API's serializer. Additionally it supports adding permissions to the default and custom list actions to restrict the data they retrive per user. +The [DRY Rest Permissions][dry-rest-permissions] package provides the ability to define different permissions for individual default and custom actions. This package is made for apps with permissions that are derived from relationships defined in the app's data model. It also supports permission checks being returned to a client app through the API's serializer. Additionally it supports adding permissions to the default and custom list actions to restrict the data they retrieve per user. ## Django Rest Framework Roles The [Django Rest Framework Roles][django-rest-framework-roles] package makes it easier to parameterize your API over multiple types of users. +## Django Rest Framework API Key + +The [Django Rest Framework API Key][django-rest-framework-api-key] package allows you to ensure that every request made to the server requires an API key header. You can generate one from the django admin interface. + [cite]: https://developer.apple.com/library/mac/#documentation/security/Conceptual/AuthenticationAndAuthorizationGuide/Authorization/Authorization.html [authentication]: authentication.md [throttling]: throttling.md @@ -280,3 +284,4 @@ The [Django Rest Framework Roles][django-rest-framework-roles] package makes it [rest-condition]: https://github.com/caxap/rest_condition [dry-rest-permissions]: https://github.com/Helioscene/dry-rest-permissions [django-rest-framework-roles]: https://github.com/computer-lab/django-rest-framework-roles +[django-rest-framework-api-key]: https://github.com/manosim/django-rest-framework-api-key diff --git a/docs/api-guide/routers.md b/docs/api-guide/routers.md index 10a86bdf0..d3f4186ad 100644 --- a/docs/api-guide/routers.md +++ b/docs/api-guide/routers.md @@ -118,6 +118,26 @@ The above example would now generate the following URL pattern: * URL pattern: `^users/{pk}/change-password/$` Name: `'user-change-password'` +In the case you do not want to use the default name generated for your custom action, you can use the url_name parameter to customize it. + +For example, if you want to change the name of our custom action to `'user-change-password'`, you could write: + + from myapp.permissions import IsAdminOrIsSelf + from rest_framework.decorators import detail_route + + class UserViewSet(ModelViewSet): + ... + + @detail_route(methods=['post'], permission_classes=[IsAdminOrIsSelf], url_name='change-password') + def set_password(self, request, pk=None): + ... + +The above example would now generate the following URL pattern: + +* URL pattern: `^users/{pk}/set_password/$` Name: `'user-change-password'` + +You can also use url_path and url_name parameters together to obtain extra control on URL generation for custom views. + For more information see the viewset documentation on [marking extra actions for routing][route-decorators]. # API Guide diff --git a/docs/api-guide/schemas.md b/docs/api-guide/schemas.md index 95eb05a40..f43ff56bd 100644 --- a/docs/api-guide/schemas.md +++ b/docs/api-guide/schemas.md @@ -145,6 +145,18 @@ May be used to pass a canonical URL for the schema. url='https://www.example.org/api/' ) +#### `urlconf` + +A string representing the import path to the URL conf that you want +to generate an API schema for. This defaults to the value of Django's +ROOT_URLCONF setting. + + schema_view = get_schema_view( + title='Server Monitoring API', + url='https://www.example.org/api/', + urlconf='myproject.urls' + ) + #### `renderer_classes` May be used to pass the set of renderer classes that can be used to render the API root endpoint. diff --git a/docs/api-guide/serializers.md b/docs/api-guide/serializers.md index 15e92ee72..6602d5e2c 100644 --- a/docs/api-guide/serializers.md +++ b/docs/api-guide/serializers.md @@ -1157,7 +1157,7 @@ The [html-json-forms][html-json-forms] package provides an algorithm and seriali ## QueryFields -[djangorestframework-queryfields][djangorestframework-queryfields] allows API clients to specify which fields will be sent in the response via inclusion or exclusion query paramaters. +[djangorestframework-queryfields][djangorestframework-queryfields] allows API clients to specify which fields will be sent in the response via inclusion/exclusion query parameters. [cite]: https://groups.google.com/d/topic/django-users/sVFaOfQi4wY/discussion diff --git a/docs/api-guide/settings.md b/docs/api-guide/settings.md index a1ea12d6e..aaedd463e 100644 --- a/docs/api-guide/settings.md +++ b/docs/api-guide/settings.md @@ -241,7 +241,7 @@ Default: If set, this maps the `'pk'` identifier in the URL conf onto the actual field name when generating a schema path parameter. Typically this will be `'id'`. This gives a more suitable representation as "primary key" is an implementation -detail, wheras "identifier" is a more general concept. +detail, whereas "identifier" is a more general concept. Default: `True` diff --git a/docs/img/premium/machinalis-readme.png b/docs/img/premium/machinalis-readme.png index 4bdb020c2..cd98c23c7 100644 Binary files a/docs/img/premium/machinalis-readme.png and b/docs/img/premium/machinalis-readme.png differ diff --git a/docs/img/premium/rollbar-readme.png b/docs/img/premium/rollbar-readme.png new file mode 100644 index 000000000..669612f72 Binary files /dev/null and b/docs/img/premium/rollbar-readme.png differ diff --git a/docs/img/premium/rover-readme.png b/docs/img/premium/rover-readme.png index c9865f2a9..b8055d62e 100644 Binary files a/docs/img/premium/rover-readme.png and b/docs/img/premium/rover-readme.png differ diff --git a/docs/img/premium/sentry-readme.png b/docs/img/premium/sentry-readme.png index 1e869f3b1..5536ce52f 100644 Binary files a/docs/img/premium/sentry-readme.png and b/docs/img/premium/sentry-readme.png differ diff --git a/docs/img/premium/stream-readme.png b/docs/img/premium/stream-readme.png index 955c11429..fc3733c70 100644 Binary files a/docs/img/premium/stream-readme.png and b/docs/img/premium/stream-readme.png differ diff --git a/docs/index.md b/docs/index.md index b035c4a7c..1760ce916 100644 --- a/docs/index.md +++ b/docs/index.md @@ -74,11 +74,12 @@ The initial aim is to provide a single full-time position on REST framework.
  • Rover.com
  • Sentry
  • Stream
  • -
  • Machinalis
  • +
  • Machinalis
  • +
  • Rollbar
  • -*Many thanks to all our [wonderful sponsors][sponsors], and in particular to our premium backers, [Rover](http://jobs.rover.com/), [Sentry](https://getsentry.com/welcome/), [Stream](https://getstream.io/?utm_source=drf&utm_medium=banner&utm_campaign=drf), and [Machinalis](http://www.machinalis.com/#services).* +*Many thanks to all our [wonderful sponsors][sponsors], and in particular to our premium backers, [Rover](http://jobs.rover.com/), [Sentry](https://getsentry.com/welcome/), [Stream](https://getstream.io/?utm_source=drf&utm_medium=banner&utm_campaign=drf), [Machinalis](https://hello.machinalis.co.uk/), and [Rollbar](https://rollbar.com).* --- @@ -260,7 +261,7 @@ Framework. For support please see the [REST framework discussion group][group], try the `#restframework` channel on `irc.freenode.net`, search [the IRC archives][botbot], or raise a question on [Stack Overflow][stack-overflow], making sure to include the ['django-rest-framework'][django-rest-framework-tag] tag. -[Paid support is available][paid-support] from [DabApps][dabapps], and can include work on REST framework core, or support with building your REST framework API. Please [contact DabApps][contact-dabapps] if you'd like to discuss commercial support options. +For priority support please sign up for a [professional or premium sponsorship plan](https://fund.django-rest-framework.org/topics/funding/). For updates on REST framework development, you may also want to follow [the author][twitter] on Twitter. diff --git a/docs/topics/3.1-announcement.md b/docs/topics/3.1-announcement.md index 9eb93fcd7..6cca40665 100644 --- a/docs/topics/3.1-announcement.md +++ b/docs/topics/3.1-announcement.md @@ -153,7 +153,7 @@ For more information, see the documentation on [customizing field mappings][cust We've now moved a number of packages out of the core of REST framework, and into separately installable packages. If you're currently using these you don't need to worry, you simply need to `pip install` the new packages, and change any import paths. -We're making this change in order to help distribute the maintainance workload, and keep better focus of the core essentials of the framework. +We're making this change in order to help distribute the maintenance workload, and keep better focus of the core essentials of the framework. The change also means we can be more flexible with which external packages we recommend. For example, the excellently maintained [Django OAuth toolkit](https://github.com/evonove/django-oauth-toolkit) has now been promoted as our recommended option for integrating OAuth support. diff --git a/docs/topics/3.4-announcement.md b/docs/topics/3.4-announcement.md index 69343c75e..438192c9c 100644 --- a/docs/topics/3.4-announcement.md +++ b/docs/topics/3.4-announcement.md @@ -89,7 +89,7 @@ Name | Support | PyPI pa ---------------------------------|-------------------------------------|-------------------------------- [Core JSON][core-json] | Schema generation & client support. | Built-in support in `coreapi`. [Swagger / OpenAPI][swagger] | Schema generation & client support. | The `openapi-codec` package. -[JSON Hyper-Schema][hyperschema] | Currrently client support only. | The `hyperschema-codec` package. +[JSON Hyper-Schema][hyperschema] | Currently client support only. | The `hyperschema-codec` package. [API Blueprint][api-blueprint] | Not yet available. | Not yet available. --- diff --git a/docs/topics/api-clients.md b/docs/topics/api-clients.md index c12551aa6..fa7b60d3e 100644 --- a/docs/topics/api-clients.md +++ b/docs/topics/api-clients.md @@ -217,7 +217,7 @@ credentials, headers and bookmarks: # Python client library -The `coreapi` Python package allows you to programatically interact with any +The `coreapi` Python package allows you to programmatically interact with any API that exposes a supported schema format. ## Getting started diff --git a/docs/topics/documenting-your-api.md b/docs/topics/documenting-your-api.md index 38f365d7d..ef4d2b4a8 100644 --- a/docs/topics/documenting-your-api.md +++ b/docs/topics/documenting-your-api.md @@ -105,7 +105,7 @@ If the python `markdown` library is installed, then [markdown syntax][markdown] [ref]: http://example.com/activating-accounts """ -Note that one constraint of using viewsets is that any documentation be used for all generated views, so for example, you cannot have differing documentation for the generated list view and detail view. +Note that when using viewsets the basic docstring is used for all generated views. To provide descriptions for each view, such as for the the list and retrieve views, use docstring sections as described in [Schemas as documentation: Examples][schemas-examples]. #### The `OPTIONS` method @@ -148,3 +148,4 @@ To implement a hypermedia API you'll need to decide on an appropriate media type [image-django-rest-swagger]: ../img/django-rest-swagger.png [image-apiary]: ../img/apiary.png [image-self-describing-api]: ../img/self-describing.png +[schemas-examples]: api-guide/schemas/#examples diff --git a/docs/topics/funding.md b/docs/topics/funding.md index 814de0a3c..91099cb3f 100644 --- a/docs/topics/funding.md +++ b/docs/topics/funding.md @@ -308,7 +308,7 @@ Our professional and premium plans also include **priority support**. At any tim Once you've signed up I'll contact you via email and arrange your ad placements on the site. -For further enquires please contact tom@tomchristie.com. +For further enquires please contact funding@django-rest-framework.org. --- diff --git a/docs/topics/kickstarter-announcement.md b/docs/topics/kickstarter-announcement.md index 78c5cce6f..6b7b428d1 100644 --- a/docs/topics/kickstarter-announcement.md +++ b/docs/topics/kickstarter-announcement.md @@ -102,7 +102,7 @@ Our gold sponsors include companies large and small. Many thanks for their signi ### Silver sponsors -The serious financial contribution that our silver sponsors have made is very much appreciated. I'd like to say a particular thank you to individuals who have choosen to privately support the project at this level. +The serious financial contribution that our silver sponsors have made is very much appreciated. I'd like to say a particular thank you to individuals who have chosen to privately support the project at this level.