Skip to content

Commit 930afc4

Browse files
committed
Make documented example runserver work
Resolves django-json-api#410: docs/getting-started.md example doesn't work.
1 parent c5d34e2 commit 930afc4

File tree

4 files changed

+25
-3
lines changed

4 files changed

+25
-3
lines changed

docs/getting-started.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,12 @@ From Source
7070

7171
git clone https://github.com/django-json-api/django-rest-framework-json-api.git
7272
cd django-rest-framework-json-api
73-
pip install -e .
7473
pip install -r example/requirements.txt
7574
django-admin.py runserver
7675

7776
Browse to http://localhost:8000
7877

7978
## Running Tests
8079

81-
python runtests.py
80+
tox
8281

example/requirements.txt

+11
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,13 @@
11
# Requirements specifically for the example app
22
packaging
3+
Django>=1.11
4+
django-debug-toolbar
5+
django-polymorphic>=2.0
6+
djangorestframework
7+
inflection
8+
pluggy
9+
py
10+
pyparsing
11+
pytz
12+
six
13+
sqlparse

example/settings/dev.py

+4
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@
6363
'debug_toolbar.middleware.DebugToolbarMiddleware',
6464
)
6565

66+
MIDDLEWARE = (
67+
'debug_toolbar.middleware.DebugToolbarMiddleware',
68+
)
69+
6670
INTERNAL_IPS = ('127.0.0.1', )
6771

6872
JSON_API_FORMAT_KEYS = 'camelize'

example/urls.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
CommentViewSet,
99
CompanyViewset,
1010
EntryViewSet,
11-
ProjectViewset
11+
ProjectViewset,
12+
EntryRelationshipView,
1213
)
1314

1415
router = routers.DefaultRouter(trailing_slash=False)
@@ -22,6 +23,13 @@
2223

2324
urlpatterns = [
2425
url(r'^', include(router.urls)),
26+
url(r'^entries/(?P<pk>[^/.]+)/relationships/(?P<related_field>\w+)',
27+
EntryRelationshipView.as_view(),
28+
name='entry-relationships'),
29+
url(r'^entries/(?P<entry_pk>[^/.]+)/suggested/',
30+
EntryViewSet.as_view({'get': 'list'}),
31+
name='entry-suggested'
32+
),
2533
]
2634

2735

0 commit comments

Comments
 (0)