diff --git a/.travis.yml b/.travis.yml index 76adf1a60..a0d72e3d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,26 +1,30 @@ language: python cache: pip -python: - - "2.7" - - "3.4" - - "3.5" - sudo: false -env: - - DJANGO=1.11 - - DJANGO=2.0 - - DJANGO=2.1 - - DJANGO=master - matrix: fast_finish: true include: - - { python: "3.6", env: DJANGO=master } + - { python: "2.7", env: DJANGO=1.11 } + + - { python: "3.4", env: DJANGO=1.11 } + - { python: "3.4", env: DJANGO=2.0 } + + - { python: "3.5", env: DJANGO=1.11 } + - { python: "3.5", env: DJANGO=2.0 } + - { python: "3.5", env: DJANGO=2.1 } + - { python: "3.5", env: DJANGO=master } + - { python: "3.6", env: DJANGO=1.11 } - { python: "3.6", env: DJANGO=2.0 } - { python: "3.6", env: DJANGO=2.1 } + - { python: "3.6", env: DJANGO=master } + + - { python: "3.7", env: DJANGO=2.0, dist: xenial, sudo: true } + - { python: "3.7", env: DJANGO=2.1, dist: xenial, sudo: true } + - { python: "3.7", env: DJANGO=master, dist: xenial, sudo: true } + - { python: "3.6", env: TOXENV=base } - { python: "2.7", env: TOXENV=lint } - { python: "2.7", env: TOXENV=docs } @@ -29,22 +33,15 @@ matrix: env: TOXENV=dist script: - python setup.py bdist_wheel + - rm -r djangorestframework.egg-info # see #6139 - tox --installpkg ./dist/djangorestframework-*.whl - tox # test sdist - exclude: - - { python: "2.7", env: DJANGO=master } - - { python: "2.7", env: DJANGO=2.0 } - - { python: "2.7", env: DJANGO=2.1 } - - { python: "3.4", env: DJANGO=master } - - { python: "3.4", env: DJANGO=2.1 } - allow_failures: - env: DJANGO=master - - env: DJANGO=2.1 install: - - pip install tox tox-travis + - pip install tox tox-venv tox-travis script: - tox diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md index 55b3e531b..8f2391d29 100644 --- a/ISSUE_TEMPLATE.md +++ b/ISSUE_TEMPLATE.md @@ -3,7 +3,7 @@ - [ ] I have verified that that issue exists against the `master` branch of Django REST framework. - [ ] I have searched for similar issues in both open and closed tickets and cannot find a duplicate. - [ ] This is not a usage question. (Those should be directed to the [discussion group](https://groups.google.com/forum/#!forum/django-rest-framework) instead.) -- [ ] This cannot be dealt with as a third party library. (We prefer new functionality to be [in the form of third party libraries](http://www.django-rest-framework.org/topics/third-party-resources/#about-third-party-packages) where possible.) +- [ ] This cannot be dealt with as a third party library. (We prefer new functionality to be [in the form of third party libraries](https://www.django-rest-framework.org/topics/third-party-resources/#about-third-party-packages) where possible.) - [ ] I have reduced the issue to the simplest possible case. - [ ] I have included a failing test as a pull request. (If you are unable to do so we can still accept the issue.) diff --git a/LICENSE.md b/LICENSE.md index 03213cbd6..3dea39c36 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ # License -Copyright © 2011-present, [Encode OSS Ltd](http://www.encode.io/). +Copyright © 2011-present, [Encode OSS Ltd](https://www.encode.io/). All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/README.md b/README.md index eebcfe13f..919f85d00 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ **Awesome web-browsable Web APIs.** -Full documentation for the project is available at [http://www.django-rest-framework.org][docs]. +Full documentation for the project is available at [https://www.django-rest-framework.org/][docs]. --- @@ -22,11 +22,11 @@ The initial aim is to provide a single full-time position on REST framework. [![][rover-img]][rover-url] [![][sentry-img]][sentry-url] [![][stream-img]][stream-url] -[![][machinalis-img]][machinalis-url] [![][rollbar-img]][rollbar-url] [![][cadre-img]][cadre-url] +[![][load-impact-img]][load-impact-url] -Many thanks to all our [wonderful sponsors][sponsors], and in particular to our premium backers, [Rover][rover-url], [Sentry][sentry-url], [Stream][stream-url], [Machinalis][machinalis-url], [Rollbar][rollbar-url], and [Cadre][cadre-url]. +Many thanks to all our [wonderful sponsors][sponsors], and in particular to our premium backers, [Rover][rover-url], [Sentry][sentry-url], [Stream][stream-url], [Rollbar][rollbar-url], [Cadre][cadre-url], and [Load Impact][load-impact-url]. --- @@ -52,8 +52,8 @@ There is a live example API for testing purposes, [available here][sandbox]. # Requirements -* Python (2.7, 3.4, 3.5, 3.6) -* Django (1.11, 2.0) +* Python (2.7, 3.4, 3.5, 3.6, 3.7) +* Django (1.11, 2.0, 2.1) # Installation @@ -142,14 +142,14 @@ You can now open the API in your browser at `http://127.0.0.1:8000/`, and view y You can also interact with the API using command line tools such as [`curl`](https://curl.haxx.se/). For example, to list the users endpoint: $ curl -H 'Accept: application/json; indent=4' -u admin:password http://127.0.0.1:8000/users/ - [ - { - "url": "http://127.0.0.1:8000/users/1/", - "username": "admin", - "email": "admin@example.com", - "is_staff": true, - } - ] + [ + { + "url": "http://127.0.0.1:8000/users/1/", + "username": "admin", + "email": "admin@example.com", + "is_staff": true, + } + ] Or to create a new user: @@ -163,7 +163,7 @@ Or to create a new user: # Documentation & Support -Full documentation for the project is available at [http://www.django-rest-framework.org][docs]. +Full documentation for the project is available at [https://www.django-rest-framework.org/][docs]. For questions and support, use the [REST framework discussion group][group], or `#restframework` on freenode IRC. @@ -191,28 +191,28 @@ Send a description of the issue via email to [rest-framework-security@googlegrou [rover-img]: https://raw.githubusercontent.com/encode/django-rest-framework/master/docs/img/premium/rover-readme.png [sentry-img]: https://raw.githubusercontent.com/encode/django-rest-framework/master/docs/img/premium/sentry-readme.png [stream-img]: https://raw.githubusercontent.com/encode/django-rest-framework/master/docs/img/premium/stream-readme.png -[machinalis-img]: https://raw.githubusercontent.com/encode/django-rest-framework/master/docs/img/premium/machinalis-readme.png [rollbar-img]: https://raw.githubusercontent.com/encode/django-rest-framework/master/docs/img/premium/rollbar-readme.png [cadre-img]: https://raw.githubusercontent.com/encode/django-rest-framework/master/docs/img/premium/cadre-readme.png +[load-impact-img]: https://raw.githubusercontent.com/encode/django-rest-framework/master/docs/img/premium/load-impact-readme.png [rover-url]: http://jobs.rover.com/ [sentry-url]: https://getsentry.com/welcome/ [stream-url]: https://getstream.io/try-the-api/?utm_source=drf&utm_medium=banner&utm_campaign=drf -[machinalis-url]: https://hello.machinalis.co.uk/ [rollbar-url]: https://rollbar.com/ [cadre-url]: https://cadre.com/ +[load-impact-url]: https://loadimpact.com/?utm_campaign=Sponsorship%20links&utm_source=drf&utm_medium=drf -[oauth1-section]: http://www.django-rest-framework.org/api-guide/authentication/#django-rest-framework-oauth -[oauth2-section]: http://www.django-rest-framework.org/api-guide/authentication/#django-oauth-toolkit -[serializer-section]: http://www.django-rest-framework.org/api-guide/serializers/#serializers -[modelserializer-section]: http://www.django-rest-framework.org/api-guide/serializers/#modelserializer -[functionview-section]: http://www.django-rest-framework.org/api-guide/views/#function-based-views -[generic-views]: http://www.django-rest-framework.org/api-guide/generic-views/ -[viewsets]: http://www.django-rest-framework.org/api-guide/viewsets/ -[routers]: http://www.django-rest-framework.org/api-guide/routers/ -[serializers]: http://www.django-rest-framework.org/api-guide/serializers/ -[authentication]: http://www.django-rest-framework.org/api-guide/authentication/ -[image]: http://www.django-rest-framework.org/img/quickstart.png +[oauth1-section]: https://www.django-rest-framework.org/api-guide/authentication/#django-rest-framework-oauth +[oauth2-section]: https://www.django-rest-framework.org/api-guide/authentication/#django-oauth-toolkit +[serializer-section]: https://www.django-rest-framework.org/api-guide/serializers/#serializers +[modelserializer-section]: https://www.django-rest-framework.org/api-guide/serializers/#modelserializer +[functionview-section]: https://www.django-rest-framework.org/api-guide/views/#function-based-views +[generic-views]: https://www.django-rest-framework.org/api-guide/generic-views/ +[viewsets]: https://www.django-rest-framework.org/api-guide/viewsets/ +[routers]: https://www.django-rest-framework.org/api-guide/routers/ +[serializers]: https://www.django-rest-framework.org/api-guide/serializers/ +[authentication]: https://www.django-rest-framework.org/api-guide/authentication/ +[image]: https://www.django-rest-framework.org/img/quickstart.png -[docs]: http://www.django-rest-framework.org/ +[docs]: https://www.django-rest-framework.org/ [security-mail]: mailto:rest-framework-security@googlegroups.com diff --git a/codecov.yml b/codecov.yml index edccd5c35..c2336342e 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,8 +1,11 @@ coverage: - status: - project: false - patch: true - changes: true + precision: 2 + round: down + range: "80...100" -comment: - layout: "diff" + status: + project: yes + patch: no + changes: no + +comment: off diff --git a/docs/api-guide/authentication.md b/docs/api-guide/authentication.md index e10e3109a..139458ad4 100644 --- a/docs/api-guide/authentication.md +++ b/docs/api-guide/authentication.md @@ -397,7 +397,7 @@ HTTP digest authentication is a widely implemented scheme that was intended to r ## JSON Web Token Authentication -JSON Web Token is a fairly new standard which can be used for token-based authentication. Unlike the built-in TokenAuthentication scheme, JWT Authentication doesn't need to use a database to validate a token. [Blimp][blimp] maintains the [djangorestframework-jwt][djangorestframework-jwt] package which provides a JWT Authentication class as well as a mechanism for clients to obtain a JWT given the username and password. An alternative package for JWT authentication is [djangorestframework-simplejwt][djangorestframework-simplejwt] which provides different features as well as a pluggable token blacklist app. +JSON Web Token is a fairly new standard which can be used for token-based authentication. Unlike the built-in TokenAuthentication scheme, JWT Authentication doesn't need to use a database to validate a token. A package for JWT authentication is [djangorestframework-simplejwt][djangorestframework-simplejwt] which provides some features as well as a pluggable token blacklist app. ## Hawk HTTP Authentication @@ -445,8 +445,6 @@ HTTP Signature (currently a [IETF draft][http-signature-ietf-draft]) provides a [django-oauth-toolkit]: https://github.com/evonove/django-oauth-toolkit [evonove]: https://github.com/evonove/ [oauthlib]: https://github.com/idan/oauthlib -[blimp]: https://github.com/GetBlimp -[djangorestframework-jwt]: https://github.com/GetBlimp/django-rest-framework-jwt [djangorestframework-simplejwt]: https://github.com/davesque/django-rest-framework-simplejwt [etoccalino]: https://github.com/etoccalino/ [djangorestframework-httpsignature]: https://github.com/etoccalino/django-rest-framework-httpsignature diff --git a/docs/api-guide/filtering.md b/docs/api-guide/filtering.md index e405535ba..84c6d8d63 100644 --- a/docs/api-guide/filtering.md +++ b/docs/api-guide/filtering.md @@ -285,6 +285,12 @@ The `ordering` attribute may be either a string or a list/tuple of strings. The `DjangoObjectPermissionsFilter` is intended to be used together with the [`django-guardian`][guardian] package, with custom `'view'` permissions added. The filter will ensure that querysets only returns objects for which the user has the appropriate view permission. +--- + +**Note:** This filter has been deprecated as of version 3.9 and moved to the 3rd-party [`djangorestframework-guardian` package][django-rest-framework-guardian]. + +--- + If you're using `DjangoObjectPermissionsFilter`, you'll probably also want to add an appropriate object permissions class, to ensure that users can only operate on instances if they have the appropriate object permissions. The easiest way to do this is to subclass `DjangoObjectPermissions` and add `'view'` permissions to the `perms_map` attribute. A complete example using both `DjangoObjectPermissionsFilter` and `DjangoObjectPermissions` might look something like this. @@ -388,6 +394,7 @@ The [djangorestframework-word-filter][django-rest-framework-word-search-filter] [view-permissions-blogpost]: https://blog.nyaruka.com/adding-a-view-permission-to-django-models [search-django-admin]: https://docs.djangoproject.com/en/stable/ref/contrib/admin/#django.contrib.admin.ModelAdmin.search_fields [django-rest-framework-filters]: https://github.com/philipn/django-rest-framework-filters +[django-rest-framework-guardian]: https://github.com/rpkilby/django-rest-framework-guardian [django-rest-framework-word-search-filter]: https://github.com/trollknurr/django-rest-framework-word-search-filter [django-url-filter]: https://github.com/miki725/django-url-filter [drf-url-filter]: https://github.com/manjitkumar/drf-url-filters diff --git a/docs/api-guide/format-suffixes.md b/docs/api-guide/format-suffixes.md index 05dde47f2..629f003f3 100644 --- a/docs/api-guide/format-suffixes.md +++ b/docs/api-guide/format-suffixes.md @@ -90,4 +90,4 @@ It is actually a misconception. For example, take the following quote from Roy The quote does not mention Accept headers, but it does make it clear that format suffixes should be considered an acceptable pattern. [cite]: http://tech.groups.yahoo.com/group/rest-discuss/message/5857 -[cite2]: http://tech.groups.yahoo.com/group/rest-discuss/message/14844 +[cite2]: https://groups.yahoo.com/neo/groups/rest-discuss/conversations/topics/14844 diff --git a/docs/api-guide/metadata.md b/docs/api-guide/metadata.md index affeea61c..a3ba9ac20 100644 --- a/docs/api-guide/metadata.md +++ b/docs/api-guide/metadata.md @@ -117,5 +117,5 @@ If you wish to do so, it also provides an exporter that can export those schema [cite]: https://tools.ietf.org/html/rfc7231#section-4.3.7 [no-options]: https://www.mnot.net/blog/2012/10/29/NO_OPTIONS -[json-schema]: http://json-schema.org/ +[json-schema]: https://json-schema.org/ [drf-schema-adapter]: https://github.com/drf-forms/drf-schema-adapter diff --git a/docs/api-guide/pagination.md b/docs/api-guide/pagination.md index c1e487c67..7ae351a7f 100644 --- a/docs/api-guide/pagination.md +++ b/docs/api-guide/pagination.md @@ -46,7 +46,7 @@ If you want to modify particular aspects of the pagination style, you'll want to page_size_query_param = 'page_size' max_page_size = 1000 -You can then apply your new style to a view using the `.pagination_class` attribute: +You can then apply your new style to a view using the `pagination_class` attribute: class BillingRecordsView(generics.ListAPIView): queryset = Billing.objects.all() @@ -319,5 +319,5 @@ The [`django-rest-framework-link-header-pagination` package][drf-link-header-pag [paginate-by-max-mixin]: https://chibisov.github.io/drf-extensions/docs/#paginatebymaxmixin [drf-proxy-pagination]: https://github.com/tuffnatty/drf-proxy-pagination [drf-link-header-pagination]: https://github.com/tbeadle/django-rest-framework-link-header-pagination -[disqus-cursor-api]: http://cra.mr/2011/03/08/building-cursors-for-the-disqus-api +[disqus-cursor-api]: https://cra.mr/2011/03/08/building-cursors-for-the-disqus-api [float_cursor_pagination_example]: https://gist.github.com/keturn/8bc88525a183fd41c73ffb729b8865be#file-fpcursorpagination-py diff --git a/docs/api-guide/permissions.md b/docs/api-guide/permissions.md index f5fc214cd..0fef12a59 100644 --- a/docs/api-guide/permissions.md +++ b/docs/api-guide/permissions.md @@ -168,9 +168,7 @@ As with `DjangoModelPermissions` you can use custom model permissions by overrid --- -**Note**: If you need object level `view` permissions for `GET`, `HEAD` and `OPTIONS` requests, you'll want to consider also adding the `DjangoObjectPermissionsFilter` class to ensure that list endpoints only return results including objects for which the user has appropriate view permissions. - ---- +**Note**: If you need object level `view` permissions for `GET`, `HEAD` and `OPTIONS` requests and are using django-guardian for your object-level permissions backend, you'll want to consider using the `DjangoObjectPermissionsFilter` class provided by the [`djangorestframework-guardian` package][django-rest-framework-guardian]. It ensures that list endpoints only return results including objects for which the user has appropriate view permissions. --- @@ -287,3 +285,4 @@ The [Django Rest Framework Role Filters][django-rest-framework-role-filters] pac [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 [django-rest-framework-role-filters]: https://github.com/allisson/django-rest-framework-role-filters +[django-rest-framework-guardian]: https://github.com/rpkilby/django-rest-framework-guardian diff --git a/docs/api-guide/relations.md b/docs/api-guide/relations.md index 02ecf5b12..6a865b7d1 100644 --- a/docs/api-guide/relations.md +++ b/docs/api-guide/relations.md @@ -594,7 +594,7 @@ The [rest-framework-generic-relations][drf-nested-relations] library provides re [cite]: https://lwn.net/Articles/193245/ [reverse-relationships]: https://docs.djangoproject.com/en/stable/topics/db/queries/#following-relationships-backward -[routers]: http://www.django-rest-framework.org/api-guide/routers#defaultrouter +[routers]: https://www.django-rest-framework.org/api-guide/routers#defaultrouter [generic-relations]: https://docs.djangoproject.com/en/stable/ref/contrib/contenttypes/#id1 [drf-nested-routers]: https://github.com/alanjds/drf-nested-routers [drf-nested-relations]: https://github.com/Ian-Foote/rest-framework-generic-relations diff --git a/docs/api-guide/renderers.md b/docs/api-guide/renderers.md index d547a7bbf..a43f4be8a 100644 --- a/docs/api-guide/renderers.md +++ b/docs/api-guide/renderers.md @@ -457,6 +457,43 @@ Modify your REST framework settings. [MessagePack][messagepack] is a fast, efficient binary serialization format. [Juan Riaza][juanriaza] maintains the [djangorestframework-msgpack][djangorestframework-msgpack] package which provides MessagePack renderer and parser support for REST framework. +## XLSX (Binary Spreadsheet Endpoints) + +XLSX is the world's most popular binary spreadsheet format. [Tim Allen][flipperpa] of [The Wharton School][wharton] maintains [drf-renderer-xlsx][drf-renderer-xlsx], which renders an endpoint as an XLSX spreadsheet using OpenPyXL, and allows the client to download it. Spreadsheets can be styled on a per-view basis. + +#### Installation & configuration + +Install using pip. + + $ pip install drf-renderer-xlsx + +Modify your REST framework settings. + + REST_FRAMEWORK = { + ... + + 'DEFAULT_RENDERER_CLASSES': ( + 'rest_framework.renderers.JSONRenderer', + 'rest_framework.renderers.BrowsableAPIRenderer', + 'drf_renderer_xlsx.renderers.XLSXRenderer', + ), + } + +To avoid having a file streamed without a filename (which the browser will often default to the filename "download", with no extension), we need to use a mixin to override the `Content-Disposition` header. If no filename is provided, it will default to `export.xlsx`. For example: + + from rest_framework.viewsets import ReadOnlyModelViewSet + from drf_renderer_xlsx.mixins import XLSXFileMixin + from drf_renderer_xlsx.renderers import XLSXRenderer + + from .models import MyExampleModel + from .serializers import MyExampleSerializer + + class MyExampleViewSet(XLSXFileMixin, ReadOnlyModelViewSet): + queryset = MyExampleModel.objects.all() + serializer_class = MyExampleSerializer + renderer_classes = (XLSXRenderer,) + filename = 'my_export.xlsx' + ## CSV Comma-separated values are a plain-text tabular data format, that can be easily imported into spreadsheet applications. [Mjumbe Poe][mjumbewu] maintains the [djangorestframework-csv][djangorestframework-csv] package which provides CSV renderer support for REST framework. @@ -484,19 +521,22 @@ Comma-separated values are a plain-text tabular data format, that can be easily [browser-accept-headers]: http://www.gethifi.com/blog/browser-rest-http-accept-headers [testing]: testing.md [HATEOAS]: http://timelessrepo.com/haters-gonna-hateoas -[quote]: http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven +[quote]: https://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven [application/vnd.github+json]: https://developer.github.com/v3/media/ [application/vnd.collection+json]: http://www.amundsen.com/media-types/collection/ [django-error-views]: https://docs.djangoproject.com/en/stable/topics/http/views/#customizing-error-views [rest-framework-jsonp]: https://jpadilla.github.io/django-rest-framework-jsonp/ [cors]: https://www.w3.org/TR/cors/ -[cors-docs]: http://www.django-rest-framework.org/topics/ajax-csrf-cors/ +[cors-docs]: https://www.django-rest-framework.org/topics/ajax-csrf-cors/ [jsonp-security]: https://stackoverflow.com/questions/613962/is-jsonp-safe-to-use [rest-framework-yaml]: https://jpadilla.github.io/django-rest-framework-yaml/ [rest-framework-xml]: https://jpadilla.github.io/django-rest-framework-xml/ [messagepack]: https://msgpack.org/ [juanriaza]: https://github.com/juanriaza [mjumbewu]: https://github.com/mjumbewu +[flipperpa]: https://githuc.com/flipperpa +[wharton]: https://github.com/wharton +[drf-renderer-xlsx]: https://github.com/wharton/drf-renderer-xlsx [vbabiy]: https://github.com/vbabiy [rest-framework-yaml]: https://jpadilla.github.io/django-rest-framework-yaml/ [rest-framework-xml]: https://jpadilla.github.io/django-rest-framework-xml/ diff --git a/docs/api-guide/requests.md b/docs/api-guide/requests.md index 83a38d1c3..35b976c66 100644 --- a/docs/api-guide/requests.md +++ b/docs/api-guide/requests.md @@ -90,7 +90,7 @@ You won't typically need to access this property. --- -**Note:** You may see a `WrappedAttributeError` raised when calling the `.user` or `.auth` properties. These errors originate from an authenticator as a standard `AttributeError`, however it's necessary that they be re-raised as a different exception type in order to prevent them from being suppressed by the outer property access. Python will not recognize that the `AttributeError` orginates from the authenticator and will instaed assume that the request object does not have a `.user` or `.auth` property. The authenticator will need to be fixed. +**Note:** You may see a `WrappedAttributeError` raised when calling the `.user` or `.auth` properties. These errors originate from an authenticator as a standard `AttributeError`, however it's necessary that they be re-raised as a different exception type in order to prevent them from being suppressed by the outer property access. Python will not recognize that the `AttributeError` orginates from the authenticator and will instead assume that the request object does not have a `.user` or `.auth` property. The authenticator will need to be fixed. --- diff --git a/docs/api-guide/routers.md b/docs/api-guide/routers.md index d3ebd6866..09c6c39cb 100644 --- a/docs/api-guide/routers.md +++ b/docs/api-guide/routers.md @@ -325,7 +325,7 @@ The [wq.db package][wq.db] provides an advanced [ModelRouter][wq.db-router] clas The [`DRF-extensions` package][drf-extensions] provides [routers][drf-extensions-routers] for creating [nested viewsets][drf-extensions-nested-viewsets], [collection level controllers][drf-extensions-collection-level-controllers] with [customizable endpoint names][drf-extensions-customizable-endpoint-names]. -[cite]: http://guides.rubyonrails.org/routing.html +[cite]: https://guides.rubyonrails.org/routing.html [route-decorators]: viewsets.md#marking-extra-actions-for-routing [drf-nested-routers]: https://github.com/alanjds/drf-nested-routers [wq.db]: https://wq.io/wq.db diff --git a/docs/api-guide/schemas.md b/docs/api-guide/schemas.md index 6ad259588..b1b6ae63e 100644 --- a/docs/api-guide/schemas.md +++ b/docs/api-guide/schemas.md @@ -146,7 +146,7 @@ example above. Automatic schema generation is provided by the `SchemaGenerator` class. -`SchemaGenerator` processes a list of routed URL pattterns and compiles the +`SchemaGenerator` processes a list of routed URL patterns and compiles the appropriately structured Core API Document. Basic usage is just to provide the title for your schema and call @@ -818,7 +818,7 @@ A short description of the meaning and intended usage of the input field. ## drf-yasg - Yet Another Swagger Generator -[drf-yasg][drf-yasg] generates [OpenAPI][open-api] documents suitable for code generation - nested schemas, +[drf-yasg][drf-yasg] generates [OpenAPI][open-api] documents suitable for code generation - nested schemas, named models, response bodies, enum/pattern/min/max validators, form parameters, etc. @@ -829,12 +829,12 @@ in [OpenAPI][open-api] format. [cite]: https://blog.heroku.com/archives/2014/1/8/json_schema_for_heroku_platform_api -[coreapi]: http://www.coreapi.org/ -[corejson]: http://www.coreapi.org/specification/encoding/#core-json-encoding +[coreapi]: https://www.coreapi.org/ +[corejson]: https://www.coreapi.org/specification/encoding/#core-json-encoding [drf-yasg]: https://github.com/axnsan12/drf-yasg/ [open-api]: https://openapis.org/ [drf-openapi]: https://github.com/limdauto/drf_openapi -[json-hyperschema]: http://json-schema.org/latest/json-schema-hypermedia.html +[json-hyperschema]: https://json-schema.org/latest/json-schema-hypermedia.html [api-blueprint]: https://apiblueprint.org/ [static-files]: https://docs.djangoproject.com/en/stable/howto/static-files/ [named-arguments]: https://docs.djangoproject.com/en/stable/topics/http/urls/#named-groups diff --git a/docs/api-guide/serializers.md b/docs/api-guide/serializers.md index 07921f2d9..19501718e 100644 --- a/docs/api-guide/serializers.md +++ b/docs/api-guide/serializers.md @@ -57,10 +57,10 @@ At this point we've translated the model instance into Python native datatypes. Deserialization is similar. First we parse a stream into Python native datatypes... - from django.utils.six import BytesIO + import io from rest_framework.parsers import JSONParser - stream = BytesIO(json) + stream = io.BytesIO(json) data = JSONParser().parse(stream) ...then we restore those native datatypes into a dictionary of validated data. @@ -1030,7 +1030,7 @@ Similar to Django forms, you can extend and reuse serializers through inheritanc class MyBaseSerializer(Serializer): my_field = serializers.CharField() - def validate_my_field(self): + def validate_my_field(self, value): ... class MySerializer(MyBaseSerializer): diff --git a/docs/api-guide/validators.md b/docs/api-guide/validators.md index 925f67206..3b50442cc 100644 --- a/docs/api-guide/validators.md +++ b/docs/api-guide/validators.md @@ -275,7 +275,7 @@ A validator may be any callable that raises a `serializers.ValidationError` on f You can specify custom field-level validation by adding `.validate_` methods to your `Serializer` subclass. This is documented in the -[Serializer docs](http://www.django-rest-framework.org/api-guide/serializers/#field-level-validation) +[Serializer docs](https://www.django-rest-framework.org/api-guide/serializers/#field-level-validation) ## Class-based diff --git a/docs/api-guide/viewsets.md b/docs/api-guide/viewsets.md index d98f518b3..e7cf4d48f 100644 --- a/docs/api-guide/viewsets.md +++ b/docs/api-guide/viewsets.md @@ -127,7 +127,7 @@ You may inspect these attributes to adjust behaviour based on the current action ## Marking extra actions for routing -If you have ad-hoc methods that should be routable, you can mark them as such with the `@action` decorator. Like regular actions, extra actions may be intended for either a list of objects, or a single instance. To indicate this, set the `detail` argument to `True` or `False`. The router will configure its URL patterns accordingly. e.g., the `DefaultRouter` will configure detail actions to contain `pk` in their URL patterns. +If you have ad-hoc methods that should be routable, you can mark them as such with the `@action` decorator. Like regular actions, extra actions may be intended for either a single object, or an entire collection. To indicate this, set the `detail` argument to `True` or `False`. The router will configure its URL patterns accordingly. e.g., the `DefaultRouter` will configure detail actions to contain `pk` in their URL patterns. A more complete example of extra actions: @@ -158,7 +158,7 @@ A more complete example of extra actions: @action(detail=False) def recent_users(self, request): - recent_users = User.objects.all().order('-last_login') + recent_users = User.objects.all().order_by('-last_login') page = self.paginate_queryset(recent_users) if page is not None: @@ -174,7 +174,7 @@ The decorator can additionally take extra arguments that will be set for the rou def set_password(self, request, pk=None): ... -These decorator will route `GET` requests by default, but may also accept other HTTP methods by setting the `methods` argument. For example: +The `action` decorator will route `GET` requests by default, but may also accept other HTTP methods by setting the `methods` argument. For example: @action(detail=True, methods=['post', 'delete']) def unset_password(self, request, pk=None): @@ -186,7 +186,7 @@ To view all extra actions, call the `.get_extra_actions()` method. ### Routing additional HTTP methods for extra actions -Extra actions can be mapped to different `ViewSet` methods. For example, the above password set/unset methods could be consolidated into a single route. Note that additional mappings do not accept arguments. +Extra actions can map additional HTTP methods to separate `ViewSet` methods. For example, the above password set/unset methods could be consolidated into a single route. Note that additional mappings do not accept arguments. ```python @action(detail=True, methods=['put'], name='Change Password') @@ -314,5 +314,5 @@ To create a base viewset class that provides `create`, `list` and `retrieve` ope By creating your own base `ViewSet` classes, you can provide common behavior that can be reused in multiple viewsets across your API. -[cite]: http://guides.rubyonrails.org/routing.html +[cite]: https://guides.rubyonrails.org/routing.html [routers]: routers.md diff --git a/docs/community/3.0-announcement.md b/docs/community/3.0-announcement.md index 66a035380..83aec9e60 100644 --- a/docs/community/3.0-announcement.md +++ b/docs/community/3.0-announcement.md @@ -960,6 +960,6 @@ The 3.2 release is planned to introduce an alternative admin-style interface to You can follow development on the GitHub site, where we use [milestones to indicate planning timescales](https://github.com/encode/django-rest-framework/milestones). [kickstarter]: https://www.kickstarter.com/projects/tomchristie/django-rest-framework-3 -[sponsors]: http://www.django-rest-framework.org/topics/kickstarter-announcement/#sponsors +[sponsors]: https://www.django-rest-framework.org/topics/kickstarter-announcement/#sponsors [mixins.py]: https://github.com/encode/django-rest-framework/blob/master/rest_framework/mixins.py [django-localization]: https://docs.djangoproject.com/en/stable/topics/i18n/translation/#localization-how-to-create-language-files diff --git a/docs/community/3.2-announcement.md b/docs/community/3.2-announcement.md index c022231a0..a6db0e54b 100644 --- a/docs/community/3.2-announcement.md +++ b/docs/community/3.2-announcement.md @@ -10,7 +10,7 @@ We've also fixed a huge number of issues, and made numerous cleanups and improve Over the course of the 3.1.x series we've [resolved nearly 600 tickets](https://github.com/encode/django-rest-framework/issues?utf8=%E2%9C%93&q=closed%3A%3E2015-03-05) on our GitHub issue tracker. This means we're currently running at a rate of **closing around 100 issues or pull requests per month**. -None of this would have been possible without the support of our wonderful Kickstarter backers. If you're looking for a job in Django development we'd strongly recommend taking [a look through our sponsors](http://www.django-rest-framework.org/topics/kickstarter-announcement/#sponsors) and finding out who's hiring. +None of this would have been possible without the support of our wonderful Kickstarter backers. If you're looking for a job in Django development we'd strongly recommend taking [a look through our sponsors](https://www.django-rest-framework.org/topics/kickstarter-announcement/#sponsors) and finding out who's hiring. ## AdminRenderer diff --git a/docs/community/3.4-announcement.md b/docs/community/3.4-announcement.md index 73ec3f2a2..44270fd85 100644 --- a/docs/community/3.4-announcement.md +++ b/docs/community/3.4-announcement.md @@ -178,12 +178,12 @@ The full set of itemized release notes [are available here][release-notes]. [sponsors]: https://fund.django-rest-framework.org/topics/funding/#our-sponsors [moss]: mozilla-grant.md [funding]: funding.md -[core-api]: http://www.coreapi.org/ +[core-api]: https://www.coreapi.org/ [command-line-client]: api-clients#command-line-client [client-library]: api-clients#python-client-library -[core-json]: http://www.coreapi.org/specification/encoding/#core-json-encoding +[core-json]: https://www.coreapi.org/specification/encoding/#core-json-encoding [swagger]: https://openapis.org/specification -[hyperschema]: http://json-schema.org/latest/json-schema-hypermedia.html +[hyperschema]: https://json-schema.org/latest/json-schema-hypermedia.html [api-blueprint]: https://apiblueprint.org/ [tut-7]: ../tutorial/7-schemas-and-client-libraries/ [schema-generation]: ../api-guide/schemas/ diff --git a/docs/community/funding.md b/docs/community/funding.md index 0faf2164b..8f0e02515 100644 --- a/docs/community/funding.md +++ b/docs/community/funding.md @@ -123,10 +123,10 @@ REST framework continues to be open-source and permissively licensed, but we fir ## What funding has enabled so far -* The [3.4](http://www.django-rest-framework.org/topics/3.4-announcement/) and [3.5](http://www.django-rest-framework.org/topics/3.5-announcement/) releases, including schema generation for both Swagger and RAML, a Python client library, a Command Line client, and addressing of a large number of outstanding issues. -* The [3.6](http://www.django-rest-framework.org/topics/3.6-announcement/) release, including JavaScript client library, and API documentation, complete with auto-generated code samples. -* The [3.7 release](http://www.django-rest-framework.org/topics/3.7-announcement/), made possible due to our collaborative funding model, focuses on improvements to schema generation and the interactive API documentation. -* The recent [3.8 release](http://www.django-rest-framework.org/topics/3.8-announcement/). +* The [3.4](https://www.django-rest-framework.org/topics/3.4-announcement/) and [3.5](https://www.django-rest-framework.org/topics/3.5-announcement/) releases, including schema generation for both Swagger and RAML, a Python client library, a Command Line client, and addressing of a large number of outstanding issues. +* The [3.6](https://www.django-rest-framework.org/topics/3.6-announcement/) release, including JavaScript client library, and API documentation, complete with auto-generated code samples. +* The [3.7 release](https://www.django-rest-framework.org/topics/3.7-announcement/), made possible due to our collaborative funding model, focuses on improvements to schema generation and the interactive API documentation. +* The recent [3.8 release](https://www.django-rest-framework.org/topics/3.8-announcement/). * Tom Christie, the creator of Django REST framework, working on the project full-time. * Around 80-90 issues and pull requests closed per month since Tom Christie started working on the project full-time. * A community & operations manager position part-time for 4 months, helping mature the business and grow sponsorship. @@ -341,7 +341,7 @@ For further enquires please contact diff --git a/docs/community/kickstarter-announcement.md b/docs/community/kickstarter-announcement.md index e2a283e29..0e5d95b2c 100644 --- a/docs/community/kickstarter-announcement.md +++ b/docs/community/kickstarter-announcement.md @@ -78,7 +78,7 @@ Our gold sponsors include companies large and small. Many thanks for their signi
  • Mirus Research
  • Hipo
  • Byte
  • -
  • Lightning Kite
  • +
  • Lightning Kite
  • Opbeat
  • Koordinates
  • Pulsecode Inc.
  • @@ -116,7 +116,7 @@ The serious financial contribution that our silver sponsors have made is very mu
  • Garfo
  • Shippo
  • Gizmag
  • -
  • Tivix
  • +
  • Tivix
  • Safari
  • Bright Loop
  • ABA Systems
  • @@ -131,7 +131,7 @@ The serious financial contribution that our silver sponsors have made is very mu
  • Fluxility
  • Teonite
  • TrackMaven
  • -
  • Phurba
  • +
  • Phurba
  • Nephila
  • Aditium
  • OpenEye Scientific Software
  • diff --git a/docs/community/mozilla-grant.md b/docs/community/mozilla-grant.md index 4d9b1d438..5248f5cc0 100644 --- a/docs/community/mozilla-grant.md +++ b/docs/community/mozilla-grant.md @@ -4,7 +4,7 @@ We have recently been [awarded a Mozilla grant](https://blog.mozilla.org/blog/20 Additionally, we will be building on the realtime support that Django Channels provides, supporting and documenting how to build realtime APIs with REST framework. Again, this will include supporting work in the associated client libraries, making it easier to build richly interactive applications. -The [Core API](http://www.coreapi.org) project will provide the foundations for our client library support, and will allow us to support interaction using a wide range of schemas and hypermedia formats. It's worth noting that these client libraries won't be tightly coupled to solely REST framework APIs either, and will be able to interact with *any* API that exposes a supported schema or hypermedia format. +The [Core API](https://www.coreapi.org/) project will provide the foundations for our client library support, and will allow us to support interaction using a wide range of schemas and hypermedia formats. It's worth noting that these client libraries won't be tightly coupled to solely REST framework APIs either, and will be able to interact with *any* API that exposes a supported schema or hypermedia format. Specifically, the work includes: @@ -34,7 +34,7 @@ In order to ensure that I can be fully focused on trying to secure a sustainable & well-funded open source business I will be leaving my current role at [DabApps](https://www.dabapps.com/) at the end of May 2016. -I have formed a UK limited company, [Encode](http://www.encode.io), which will +I have formed a UK limited company, [Encode](https://www.encode.io/), which will act as the business entity behind REST framework. I will be issuing monthly reports from Encode on progress both towards the Mozilla grant, and for development time funded via the [REST framework paid plans](funding.md). diff --git a/docs/community/project-management.md b/docs/community/project-management.md index c7f064e13..21f93b380 100644 --- a/docs/community/project-management.md +++ b/docs/community/project-management.md @@ -39,7 +39,7 @@ The following template should be used for the description of the issue, and serv This issue is for determining the maintenance team for the *** period. - Please see the [Project management](http://www.django-rest-framework.org/topics/project-management/) section of our documentation for more details. + Please see the [Project management](https://www.django-rest-framework.org/topics/project-management/) section of our documentation for more details. --- @@ -59,7 +59,7 @@ The following template should be used for the description of the issue, and serv If you wish to be considered for this or a future date, please comment against this or subsequent issues. - To modify this process for future maintenance cycles make a pull request to the [project management](http://www.django-rest-framework.org/topics/project-management/) documentation. + To modify this process for future maintenance cycles make a pull request to the [project management](https://www.django-rest-framework.org/topics/project-management/) documentation. #### Responsibilities of team members @@ -99,7 +99,7 @@ The following template should be used for the description of the issue, and serv During development cycle: - - [ ] Upload the new content to be translated to [transifex](http://www.django-rest-framework.org/topics/project-management/#translations). + - [ ] Upload the new content to be translated to [transifex](https://www.django-rest-framework.org/topics/project-management/#translations). Checklist: @@ -110,7 +110,7 @@ The following template should be used for the description of the issue, and serv - [ ] `setup.py` Python & Django version trove classifiers - [ ] `README` Python & Django versions - [ ] `docs` Python & Django versions - - [ ] Update the translations from [transifex](http://www.django-rest-framework.org/topics/project-management/#translations). + - [ ] Update the translations from [transifex](https://www.django-rest-framework.org/topics/project-management/#translations). - [ ] Ensure the pull request increments the version to `*.*.*` in [`restframework/__init__.py`](https://github.com/encode/django-rest-framework/blob/master/rest_framework/__init__.py). - [ ] Confirm with @tomchristie that release is finalized and ready to go. - [ ] Ensure that release date is included in pull request. @@ -122,7 +122,7 @@ The following template should be used for the description of the issue, and serv - [ ] Make a release announcement on twitter. - [ ] Close the milestone on GitHub. - To modify this process for future releases make a pull request to the [project management](http://www.django-rest-framework.org/topics/project-management/) documentation. + To modify this process for future releases make a pull request to the [project management](https://www.django-rest-framework.org/topics/project-management/) documentation. When pushing the release to PyPI ensure that your environment has been installed from our development `requirement.txt`, so that documentation and PyPI installs are consistently being built against a pinned set of packages. diff --git a/docs/community/release-notes.md b/docs/community/release-notes.md index e9f8d5abc..700d1d97f 100644 --- a/docs/community/release-notes.md +++ b/docs/community/release-notes.md @@ -46,6 +46,7 @@ You can determine your currently installed version using `pip show`: * Deprecate the `Router.register` `base_name` argument in favor of `basename`. [#5990][gh5990] * Deprecate the `Router.get_default_base_name` method in favor of `Router.get_default_basename`. [#5990][gh5990] +* Deprecate the `DjangoObjectPermissionsFilter` class, moved to the `djangorestframework-guardian` package. [#6075][gh6075] ## 3.8.x series @@ -1974,3 +1975,4 @@ For older release notes, [please see the version 2.x documentation][old-release- [gh5990]: https://github.com/encode/django-rest-framework/issues/5990 +[gh6075]: https://github.com/encode/django-rest-framework/issues/6075 diff --git a/docs/community/tutorials-and-resources.md b/docs/community/tutorials-and-resources.md index 8c30bbeaa..a03d63a3c 100644 --- a/docs/community/tutorials-and-resources.md +++ b/docs/community/tutorials-and-resources.md @@ -85,8 +85,8 @@ Want your Django REST Framework talk/tutorial/article to be added to our website [beginners-guide-to-the-django-rest-framework]: https://code.tutsplus.com/tutorials/beginners-guide-to-the-django-rest-framework--cms-19786 -[getting-started-with-django-rest-framework-and-angularjs]: http://blog.kevinastone.com/getting-started-with-django-rest-framework-and-angularjs.html -[end-to-end-web-app-with-django-rest-framework-angularjs]: http://mourafiq.com/2013/07/01/end-to-end-web-app-with-django-angular-1.html +[getting-started-with-django-rest-framework-and-angularjs]: https://blog.kevinastone.com/getting-started-with-django-rest-framework-and-angularjs.html +[end-to-end-web-app-with-django-rest-framework-angularjs]: https://mourafiq.com/2013/07/01/end-to-end-web-app-with-django-angular-1.html [start-your-api-django-rest-framework-part-1]: https://godjango.com/41-start-your-api-django-rest-framework-part-1/ [permissions-authentication-django-rest-framework-part-2]: https://godjango.com/43-permissions-authentication-django-rest-framework-part-2/ [viewsets-and-routers-django-rest-framework-part-3]: https://godjango.com/45-viewsets-and-routers-django-rest-framework-part-3/ diff --git a/docs/img/premium/load-impact-readme.png b/docs/img/premium/load-impact-readme.png new file mode 100644 index 000000000..c46d36ada Binary files /dev/null and b/docs/img/premium/load-impact-readme.png differ diff --git a/docs/index.md b/docs/index.md index f709502d7..8079bff15 100644 --- a/docs/index.md +++ b/docs/index.md @@ -69,13 +69,13 @@ continued development by **[signing up for a paid plan][funding]**.
  • Rover.com
  • Sentry
  • Stream
  • -
  • Machinalis
  • Rollbar
  • Cadre
  • +
  • Load Impact
  • -*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/), [Rollbar](https://rollbar.com), and [Cadre](https://cadre.com).* +*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), [Rollbar](https://rollbar.com), [Cadre](https://cadre.com), and [Load Impact](https://loadimpact.com/?utm_campaign=Sponsorship%20links&utm_source=drf&utm_medium=drf).* --- @@ -83,8 +83,8 @@ continued development by **[signing up for a paid plan][funding]**. REST framework requires the following: -* Python (2.7, 3.4, 3.5, 3.6) -* Django (1.11, 2.0) +* Python (2.7, 3.4, 3.5, 3.6, 3.7) +* Django (1.11, 2.0, 2.1) The following packages are optional: @@ -200,17 +200,22 @@ Send a description of the issue via email to [rest-framework-security@googlegrou ## License -Copyright (c) 2011-2017, Tom Christie +Copyright © 2011-present, [Encode OSS Ltd](https://www.encode.io/). All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -Redistributions of source code must retain the above copyright notice, this -list of conditions and the following disclaimer. -Redistributions in binary form must reproduce the above copyright notice, this -list of conditions and the following disclaimer in the documentation and/or -other materials provided with the distribution. +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED diff --git a/docs/topics/api-clients.md b/docs/topics/api-clients.md index ec0b4272c..3fd560634 100644 --- a/docs/topics/api-clients.md +++ b/docs/topics/api-clients.md @@ -521,7 +521,7 @@ You'll either want to include the API schema in your codebase directly, by copyi }) [heroku-api]: https://devcenter.heroku.com/categories/platform-api -[heroku-example]: http://www.coreapi.org/tools-and-resources/example-services/#heroku-json-hyper-schema -[core-api]: http://www.coreapi.org/ +[heroku-example]: https://www.coreapi.org/tools-and-resources/example-services/#heroku-json-hyper-schema +[core-api]: https://www.coreapi.org/ [schema-generation]: ../api-guide/schemas.md [transport-adaptors]: http://docs.python-requests.org/en/master/user/advanced/#transport-adapters diff --git a/docs/topics/browser-enhancements.md b/docs/topics/browser-enhancements.md index 32eab43a8..0e79a66e1 100644 --- a/docs/topics/browser-enhancements.md +++ b/docs/topics/browser-enhancements.md @@ -82,6 +82,6 @@ as well as how to support content types other than form-encoded data. [cite]: https://www.amazon.com/RESTful-Web-Services-Leonard-Richardson/dp/0596529260 [ajax-form]: https://github.com/encode/ajax-form -[rails]: http://guides.rubyonrails.org/form_helpers.html#how-do-forms-with-put-or-delete-methods-work +[rails]: https://guides.rubyonrails.org/form_helpers.html#how-do-forms-with-put-or-delete-methods-work [html5]: https://www.w3.org/TR/html5-diff/#changes-2010-06-24 [put_delete]: http://amundsen.com/examples/put-delete-forms/ diff --git a/docs/topics/documenting-your-api.md b/docs/topics/documenting-your-api.md index d57f9d6e4..f57b51ee0 100644 --- a/docs/topics/documenting-your-api.md +++ b/docs/topics/documenting-your-api.md @@ -16,11 +16,11 @@ The built-in API documentation includes: ### Installation -The `coreapi` library is required as a dependancy for the API docs. Make sure +The `coreapi` library is required as a dependency for the API docs. Make sure to install the latest version. The `pygments` and `markdown` libraries are optional but recommended. -To install the API documentation, you'll need to include it in your projects URLconf: +To install the API documentation, you'll need to include it in your project's URLconf: from rest_framework.documentation import include_docs_urls @@ -39,7 +39,7 @@ This will include two different views: **Note**: By default `include_docs_urls` configures the underlying `SchemaView` to generate _public_ schemas. This means that views will not be instantiated with a `request` instance. i.e. Inside the view `self.request` will be `None`. -To be compatible with this behaviour methods (such as `get_serializer` or `get_serializer_class` etc.) which inspect `self.request` or, particularly, `self.request.user` may need to be adjusted to handle this case. +To be compatible with this behaviour, methods (such as `get_serializer` or `get_serializer_class` etc.) which inspect `self.request` or, particularly, `self.request.user` may need to be adjusted to handle this case. You may ensure views are given a `request` instance by calling `include_docs_urls` with `public=False`: @@ -313,7 +313,7 @@ In this approach, rather than documenting the available API endpoints up front, To implement a hypermedia API you'll need to decide on an appropriate media type for the API, and implement a custom renderer and parser for that media type. The [REST, Hypermedia & HATEOAS][hypermedia-docs] section of the documentation includes pointers to background reading, as well as links to various hypermedia formats. -[cite]: http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven +[cite]: https://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven [drf-yasg]: https://github.com/axnsan12/drf-yasg/ [image-drf-yasg]: ../img/drf-yasg.png [drf-openapi]: https://github.com/limdauto/drf_openapi/ diff --git a/docs/topics/html-and-forms.md b/docs/topics/html-and-forms.md index 0b4afca12..18774926b 100644 --- a/docs/topics/html-and-forms.md +++ b/docs/topics/html-and-forms.md @@ -4,7 +4,7 @@ REST framework is suitable for returning both API style responses, and regular H ## Rendering HTML -In order to return HTML responses you'll need to either `TemplateHTMLRenderer`, or `StaticHTMLRenderer`. +In order to return HTML responses you'll need to use either `TemplateHTMLRenderer`, or `StaticHTMLRenderer`. The `TemplateHTMLRenderer` class expects the response to contain a dictionary of context data, and renders an HTML page based on a template that must be specified either in the view or on the response. diff --git a/docs/topics/internationalization.md b/docs/topics/internationalization.md index ed8b85836..7cfc6e247 100644 --- a/docs/topics/internationalization.md +++ b/docs/topics/internationalization.md @@ -43,7 +43,7 @@ REST framework includes these built-in translations both for standard exception Note that the translations only apply to the error strings themselves. The format of error messages, and the keys of field names will remain the same. An example `400 Bad Request` response body might look like this: - {"detail": {"username": ["Esse campo deve ser unico."]}} + {"detail": {"username": ["Esse campo deve ser único."]}} If you want to use different string for parts of the response such as `detail` and `non_field_errors` then you can modify this behavior by using a [custom exception handler][custom-exception-handler]. diff --git a/docs/topics/rest-hypermedia-hateoas.md b/docs/topics/rest-hypermedia-hateoas.md index aa889f62b..d48319a26 100644 --- a/docs/topics/rest-hypermedia-hateoas.md +++ b/docs/topics/rest-hypermedia-hateoas.md @@ -36,7 +36,7 @@ What REST framework doesn't do is give you machine readable hypermedia formats s [cite]: https://vimeo.com/channels/restfest/page:2 [dissertation]: https://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm -[hypertext-driven]: http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven +[hypertext-driven]: https://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven [restful-web-apis]: http://restfulwebapis.org/ [building-hypermedia-apis]: https://www.amazon.com/Building-Hypermedia-APIs-HTML5-Node/dp/1449306578 [designing-hypermedia-apis]: http://designinghypermediaapis.com/ diff --git a/docs/topics/writable-nested-serializers.md b/docs/topics/writable-nested-serializers.md index a39feb18c..9ba719f4e 100644 --- a/docs/topics/writable-nested-serializers.md +++ b/docs/topics/writable-nested-serializers.md @@ -27,7 +27,7 @@ Nested data structures are easy enough to work with if they're read-only - simpl Some example output from our serializer. { - 'title': 'Leaving party preperations', + 'title': 'Leaving party preparations', 'items': [ {'text': 'Compile playlist', 'is_completed': True}, {'text': 'Send invites', 'is_completed': False}, diff --git a/docs/tutorial/1-serialization.md b/docs/tutorial/1-serialization.md index aa94eeb0e..630c3da0a 100644 --- a/docs/tutorial/1-serialization.md +++ b/docs/tutorial/1-serialization.md @@ -154,9 +154,9 @@ At this point we've translated the model instance into Python native datatypes. Deserialization is similar. First we parse a stream into Python native datatypes... - from django.utils.six import BytesIO + import io - stream = BytesIO(content) + stream = io.BytesIO(content) data = JSONParser().parse(stream) ...then we restore those native datatypes into a fully populated object instance. diff --git a/docs/tutorial/7-schemas-and-client-libraries.md b/docs/tutorial/7-schemas-and-client-libraries.md index f8060ac29..412759834 100644 --- a/docs/tutorial/7-schemas-and-client-libraries.md +++ b/docs/tutorial/7-schemas-and-client-libraries.md @@ -89,7 +89,7 @@ Now check that it is available on the command line... Command line client for interacting with CoreAPI services. - Visit http://www.coreapi.org for more information. + Visit https://www.coreapi.org/ for more information. Options: --version Display the package version number. @@ -220,8 +220,8 @@ We've reached the end of our tutorial. If you want to get more involved in the **Now go build awesome things.** -[coreapi]: http://www.coreapi.org -[corejson]: http://www.coreapi.org/specification/encoding/#core-json-encoding +[coreapi]: https://www.coreapi.org/ +[corejson]: https://www.coreapi.org/specification/encoding/#core-json-encoding [openapi]: https://openapis.org/ [repo]: https://github.com/encode/rest-framework-tutorial [sandbox]: https://restframework.herokuapp.com/ diff --git a/docs/tutorial/quickstart.md b/docs/tutorial/quickstart.md index 466baeebc..13152edae 100644 --- a/docs/tutorial/quickstart.md +++ b/docs/tutorial/quickstart.md @@ -56,7 +56,7 @@ We'll also create an initial user named `admin` with a password of `password123` python manage.py createsuperuser --email admin@example.com --username admin -Once you've set up a database and initial user created and ready to go, open up the app's directory and we'll get coding... +Once you've set up a database and the initial user is created and ready to go, open up the app's directory and we'll get coding... ## Serializers diff --git a/docs_theme/404.html b/docs_theme/404.html index 078b9f5ae..a89c0a418 100644 --- a/docs_theme/404.html +++ b/docs_theme/404.html @@ -4,6 +4,6 @@

    404

    Page not found

    -

    Try the homepage, or search the documentation.

    +

    Try the homepage, or search the documentation.

    {% endblock %} diff --git a/docs_theme/css/bootstrap-responsive.css b/docs_theme/css/bootstrap-responsive.css index a8caf451d..ec0b51947 100755 --- a/docs_theme/css/bootstrap-responsive.css +++ b/docs_theme/css/bootstrap-responsive.css @@ -3,7 +3,7 @@ * * Copyright 2012 Twitter, Inc * Licensed under the Apache License v2.0 - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Designed and built with all the love in the world @twitter by @mdo and @fat. */ diff --git a/docs_theme/css/bootstrap.css b/docs_theme/css/bootstrap.css index 53df68595..a48bbbecf 100755 --- a/docs_theme/css/bootstrap.css +++ b/docs_theme/css/bootstrap.css @@ -3,7 +3,7 @@ * * Copyright 2012 Twitter, Inc * Licensed under the Apache License v2.0 - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Designed and built with all the love in the world @twitter by @mdo and @fat. */ diff --git a/docs_theme/nav.html b/docs_theme/nav.html index 914d80a27..f093178d3 100644 --- a/docs_theme/nav.html +++ b/docs_theme/nav.html @@ -14,7 +14,7 @@ - Django REST framework + Django REST framework