diff options
| author | Tom Christie | 2014-12-08 15:16:45 +0000 |
|---|---|---|
| committer | Tom Christie | 2014-12-08 15:16:45 +0000 |
| commit | 61eb64ed2424bbff8879311121c9a5dfe21f721d (patch) | |
| tree | 548b2bdb9a9de1a4fbe01b7c8d9a20ea9507c066 /tutorial | |
| parent | 78f5bcb5cbc9cbed6c335734e81714bc2daa294a (diff) | |
| download | django-rest-framework-61eb64ed2424bbff8879311121c9a5dfe21f721d.tar.bz2 | |
Update documentation
Diffstat (limited to 'tutorial')
| -rw-r--r-- | tutorial/4-authentication-and-permissions/index.html | 4 | ||||
| -rw-r--r-- | tutorial/5-relationships-and-hyperlinked-apis/index.html | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/tutorial/4-authentication-and-permissions/index.html b/tutorial/4-authentication-and-permissions/index.html index df92f540..2efc7245 100644 --- a/tutorial/4-authentication-and-permissions/index.html +++ b/tutorial/4-authentication-and-permissions/index.html @@ -435,7 +435,7 @@ from pygments import highlight </code></pre> <p>When that's all done we'll need to update our database tables. Normally we'd create a database migration in order to do that, but for the purposes of this tutorial, let's just delete the database and start again.</p> -<pre><code>rm tmp.db +<pre><code>rm -f tmp.db db.sqlite3 rm -r snippets/migrations python manage.py makemigrations snippets python manage.py migrate @@ -448,7 +448,7 @@ python manage.py migrate <pre><code>from django.contrib.auth.models import User class UserSerializer(serializers.ModelSerializer): - snippets = serializers.PrimaryKeyRelatedField(many=True) + snippets = serializers.PrimaryKeyRelatedField(many=True, queryset=Snippet.objects.all()) class Meta: model = User diff --git a/tutorial/5-relationships-and-hyperlinked-apis/index.html b/tutorial/5-relationships-and-hyperlinked-apis/index.html index 80e84004..364de40d 100644 --- a/tutorial/5-relationships-and-hyperlinked-apis/index.html +++ b/tutorial/5-relationships-and-hyperlinked-apis/index.html @@ -421,7 +421,7 @@ class SnippetHighlight(generics.GenericAPIView): </code></pre> <p>As usual we need to add the new views that we've created in to our URLconf. We'll add a url pattern for our new API root in <code>snippets/urls.py</code>:</p> -<pre><code>url(r'^$', 'api_root'), +<pre><code>url(r'^$', views.api_root), </code></pre> <p>And then add a url pattern for the snippet highlights:</p> <pre><code>url(r'^snippets/(?P<pk>[0-9]+)/highlight/$', views.SnippetHighlight.as_view()), |
