Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 430ac15

Browse files
slivercn2ygk
authored andcommitted
Resolve sphinx documentation build warnings (#711)
1 parent 3aafbe8 commit 430ac15

File tree

3 files changed

+32
-36
lines changed

3 files changed

+32
-36
lines changed

‎docs/conf.py‎

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,14 @@
1414
# serve to show the default.
1515

1616
import datetime
17-
import sys
1817
import os
1918
import shlex
19+
import sys
20+
2021
import django
22+
from sphinx.ext.apidoc import main
23+
24+
from rest_framework_json_api import VERSION
2125

2226
# If extensions (or modules to document with autodoc) are in another directory,
2327
# add these directories to sys.path here. If the directory is relative to the
@@ -27,8 +31,7 @@
2731
django.setup()
2832

2933
# Auto-generate API documentation.
30-
from sphinx.ext.apidoc import main
31-
main(['-o', 'apidoc', '-f', '-e', '-T', '-M', '../rest_framework_json_api'])
34+
main(['-o', '_build/apidoc', '-f', '-e', '-T', '-M', '../rest_framework_json_api'])
3235

3336
# -- General configuration ------------------------------------------------
3437

@@ -38,17 +41,13 @@
3841
# Add any Sphinx extension module names here, as strings. They can be
3942
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
4043
# ones.
41-
extensions = ['sphinx.ext.autodoc']
44+
extensions = ['sphinx.ext.autodoc', 'recommonmark']
4245
autodoc_member_order = 'bysource'
4346
autodoc_inherit_docstrings = False
4447

4548
# Add any paths that contain templates here, relative to this directory.
4649
templates_path = ['_templates']
4750

48-
from recommonmark.parser import CommonMarkParser
49-
source_parsers = {
50-
'.md': CommonMarkParser,
51-
}
5251
# The suffix(es) of source filenames.
5352
# You can specify multiple suffix as a list of string:
5453
# source_suffix = ['.rst', '.md']
@@ -71,7 +70,6 @@
7170
# built documents.
7271
#
7372
# The short X.Y version.
74-
from rest_framework_json_api import VERSION
7573
version = VERSION
7674
# The full version, including alpha/beta/rc tags.
7775
release = VERSION
@@ -91,7 +89,7 @@
9189

9290
# List of patterns, relative to source directory, that match files and
9391
# directories to ignore when looking for source files.
94-
exclude_patterns = ['_build']
92+
exclude_patterns = ['_build', 'pull_request_template.md']
9593

9694
# The reST default role (used for this markup: `text`) to use for all
9795
# documents.

‎rest_framework_json_api/renderers.py‎

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,21 @@ class JSONRenderer(renderers.JSONRenderer):
2626
2727
Render a JSON response per the JSON API spec:
2828
29-
.. code:: json
29+
.. code-block:: json
3030
3131
{
32-
"data": [{
33-
"type": "companies",
34-
"id": 1,
35-
"attributes": {
36-
"name": "Mozilla",
37-
"slug": "mozilla",
38-
"date-created": "2014年03月13日 16:33:37"
39-
}
40-
}, {
41-
"type": "companies",
42-
"id": 2,
43-
...
44-
}]
32+
"data": [
33+
{
34+
"type": "companies",
35+
"id": 1,
36+
"attributes": {
37+
"name": "Mozilla",
38+
"slug": "mozilla",
39+
"date-created": "2014年03月13日 16:33:37"
40+
}
41+
}
42+
]
4543
}
46-
4744
"""
4845

4946
media_type = 'application/vnd.api+json'

‎rest_framework_json_api/views.py‎

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,20 @@ class PreloadIncludesMixin(object):
3737
3838
__all__ can be used to specify a prefetch which should be done regardless of the include
3939
40+
4041
.. code:: python
4142
42-
# When MyViewSet is called with ?include=author it will prefetch author and authorbio
43-
class MyViewSet(viewsets.ModelViewSet):
44-
queryset = Book.objects.all()
45-
prefetch_for_includes = {
46-
'__all__': [],
47-
'category.section': ['category']
48-
}
49-
select_for_includes = {
50-
'__all__': [],
51-
'author': ['author', 'author__authorbio'],
52-
}
43+
# When MyViewSet is called with ?include=author it will prefetch author and authorbio
44+
class MyViewSet(viewsets.ModelViewSet):
45+
queryset = Book.objects.all()
46+
prefetch_for_includes = {
47+
'__all__': [],
48+
'category.section': ['category']
49+
}
50+
select_for_includes = {
51+
'__all__': [],
52+
'author': ['author', 'author__authorbio'],
53+
}
5354
"""
5455

5556
def get_select_related(self, include):

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /