mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-10-22 19:54:50 +03:00
Merge 32f8d1bdde
into 9b3d03a3d2
This commit is contained in:
commit
1575c85c5e
|
@ -1,6 +1,6 @@
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
rev: v4.5.0
|
rev: v6.0.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: check-added-large-files
|
- id: check-added-large-files
|
||||||
- id: check-case-conflict
|
- id: check-case-conflict
|
||||||
|
@ -8,12 +8,12 @@ repos:
|
||||||
- id: check-merge-conflict
|
- id: check-merge-conflict
|
||||||
- id: check-symlinks
|
- id: check-symlinks
|
||||||
- id: check-toml
|
- id: check-toml
|
||||||
- repo: https://github.com/pycqa/isort
|
- repo: https://github.com/PyCQA/isort
|
||||||
rev: 5.13.2
|
rev: 7.0.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: isort
|
- id: isort
|
||||||
- repo: https://github.com/PyCQA/flake8
|
- repo: https://github.com/PyCQA/flake8
|
||||||
rev: 7.0.0
|
rev: 7.3.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: flake8
|
- id: flake8
|
||||||
additional_dependencies:
|
additional_dependencies:
|
||||||
|
@ -26,7 +26,7 @@ repos:
|
||||||
- black==25.9.0
|
- black==25.9.0
|
||||||
- repo: https://github.com/codespell-project/codespell
|
- repo: https://github.com/codespell-project/codespell
|
||||||
# Configuration for codespell is in .codespellrc
|
# Configuration for codespell is in .codespellrc
|
||||||
rev: v2.2.6
|
rev: v2.4.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: codespell
|
- id: codespell
|
||||||
exclude: locale|kickstarter-announcement.md|coreapi-0.1.1.js
|
exclude: locale|kickstarter-announcement.md|coreapi-0.1.1.js
|
||||||
|
@ -39,6 +39,6 @@ repos:
|
||||||
- id: pyupgrade
|
- id: pyupgrade
|
||||||
args: ["--py310-plus", "--keep-percent-format"]
|
args: ["--py310-plus", "--keep-percent-format"]
|
||||||
- repo: https://github.com/tox-dev/pyproject-fmt
|
- repo: https://github.com/tox-dev/pyproject-fmt
|
||||||
rev: v2.6.0
|
rev: v2.11.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: pyproject-fmt
|
- id: pyproject-fmt
|
||||||
|
|
|
@ -66,7 +66,7 @@ The REST framework package only includes a single metadata class implementation,
|
||||||
|
|
||||||
## Creating schema endpoints
|
## Creating schema endpoints
|
||||||
|
|
||||||
If you have specific requirements for creating schema endpoints that are accessed with regular `GET` requests, you might consider re-using the metadata API for doing so.
|
If you have specific requirements for creating schema endpoints that are accessed with regular `GET` requests, you might consider reusing the metadata API for doing so.
|
||||||
|
|
||||||
For example, the following additional route could be used on a viewset to provide a linkable schema endpoint.
|
For example, the following additional route could be used on a viewset to provide a linkable schema endpoint.
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ For example, when forcibly authenticating using a token, you might do something
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
**Note**: `force_authenticate` directly sets `request.user` to the in-memory `user` instance. If you are re-using the same `user` instance across multiple tests that update the saved `user` state, you may need to call [`refresh_from_db()`][refresh_from_db_docs] between tests.
|
**Note**: `force_authenticate` directly sets `request.user` to the in-memory `user` instance. If you are reusing the same `user` instance across multiple tests that update the saved `user` state, you may need to call [`refresh_from_db()`][refresh_from_db_docs] between tests.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ source:
|
||||||
|
|
||||||
# Validators
|
# Validators
|
||||||
|
|
||||||
> Validators can be useful for re-using validation logic between different types of fields.
|
> Validators can be useful for reusing validation logic between different types of fields.
|
||||||
>
|
>
|
||||||
> — [Django documentation][cite]
|
> — [Django documentation][cite]
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ class TestLazyHyperlinkNames(TestCase):
|
||||||
self.example = Example.objects.create(text='foo')
|
self.example = Example.objects.create(text='foo')
|
||||||
|
|
||||||
def test_lazy_hyperlink_names(self):
|
def test_lazy_hyperlink_names(self):
|
||||||
global str_called
|
global str_called # noqa: F824
|
||||||
context = {'request': None}
|
context = {'request': None}
|
||||||
serializer = ExampleSerializer(self.example, context=context)
|
serializer = ExampleSerializer(self.example, context=context)
|
||||||
JSONRenderer().render(serializer.data)
|
JSONRenderer().render(serializer.data)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user