mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-24 23:19:47 +03:00
blacken-docs: Manual fixes for command to pass without errors
This commit is contained in:
parent
6b73acc173
commit
1ecc66b34f
|
@ -263,7 +263,7 @@ class CustomSchema(AutoSchema):
|
||||||
|
|
||||||
class CustomView(APIView):
|
class CustomView(APIView):
|
||||||
schema = CustomSchema()
|
schema = CustomSchema()
|
||||||
schema_extra_info = ... some extra info ...
|
schema_extra_info = ... # some extra info
|
||||||
```
|
```
|
||||||
|
|
||||||
Here, the `AutoSchema` subclass goes looking for `schema_extra_info` on the
|
Here, the `AutoSchema` subclass goes looking for `schema_extra_info` on the
|
||||||
|
@ -281,7 +281,7 @@ class BaseSchema(AutoSchema):
|
||||||
...
|
...
|
||||||
|
|
||||||
class CustomSchema(BaseSchema):
|
class CustomSchema(BaseSchema):
|
||||||
extra_info = ... some extra info ...
|
extra_info = ... # some extra info
|
||||||
|
|
||||||
class CustomView(APIView):
|
class CustomView(APIView):
|
||||||
schema = CustomSchema()
|
schema = CustomSchema()
|
||||||
|
@ -304,7 +304,7 @@ class CustomSchema(BaseSchema):
|
||||||
|
|
||||||
class CustomView(APIView):
|
class CustomView(APIView):
|
||||||
schema = CustomSchema(
|
schema = CustomSchema(
|
||||||
extra_info=... some extra info ...
|
extra_info=... # some extra info
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -213,14 +213,14 @@ Note that the `basename` is provided by the router during `ViewSet` registration
|
||||||
|
|
||||||
Using the example from the previous section:
|
Using the example from the previous section:
|
||||||
|
|
||||||
```python
|
```pycon
|
||||||
>>> view.reverse_action('set-password', args=['1'])
|
>>> view.reverse_action('set-password', args=['1'])
|
||||||
'http://localhost:8000/api/users/1/set_password'
|
'http://localhost:8000/api/users/1/set_password'
|
||||||
```
|
```
|
||||||
|
|
||||||
Alternatively, you can use the `url_name` attribute set by the `@action` decorator.
|
Alternatively, you can use the `url_name` attribute set by the `@action` decorator.
|
||||||
|
|
||||||
```python
|
```pycon
|
||||||
>>> view.reverse_action(view.set_password.url_name, args=['1'])
|
>>> view.reverse_action(view.set_password.url_name, args=['1'])
|
||||||
'http://localhost:8000/api/users/1/set_password'
|
'http://localhost:8000/api/users/1/set_password'
|
||||||
```
|
```
|
||||||
|
|
|
@ -41,8 +41,8 @@ update your REST framework settings to include `DEFAULT_SCHEMA_CLASS` explicitly
|
||||||
|
|
||||||
```python
|
```python
|
||||||
REST_FRAMEWORK = {
|
REST_FRAMEWORK = {
|
||||||
...
|
...: ...,
|
||||||
'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.coreapi.AutoSchema'
|
'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.coreapi.AutoSchema',
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -43,10 +43,10 @@ be extracted from the class docstring:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
class DocStringExampleListView(APIView):
|
class DocStringExampleListView(APIView):
|
||||||
"""
|
"""
|
||||||
get: A description of my GET operation.
|
get: A description of my GET operation.
|
||||||
post: A description of my POST operation.
|
post: A description of my POST operation.
|
||||||
"""
|
"""
|
||||||
permission_classes = [permissions.IsAuthenticatedOrReadOnly]
|
permission_classes = [permissions.IsAuthenticatedOrReadOnly]
|
||||||
|
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user