Skip to content

Commit 71c49fe

Browse files
committed
Merge pull request #2219 from linovia/bugfix/tutorial_2
Update the tutorial against DRF v3 (part 4 & 5)
2 parents 544967f + e4820d6 commit 71c49fe

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

docs/tutorial/4-authentication-and-permissions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ And now we can add a `.save()` method to our model class:
4343
When that's all done we'll need to update our database tables.
4444
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.
4545

46-
rm tmp.db
46+
rm -f tmp.db db.sqlite3
4747
rm -r snippets/migrations
4848
python manage.py makemigrations snippets
4949
python manage.py migrate
@@ -59,7 +59,7 @@ Now that we've got some users to work with, we'd better add representations of t
5959
from django.contrib.auth.models import User
6060

6161
class UserSerializer(serializers.ModelSerializer):
62-
snippets = serializers.PrimaryKeyRelatedField(many=True)
62+
snippets = serializers.PrimaryKeyRelatedField(many=True, queryset=Snippet.objects.all())
6363

6464
class Meta:
6565
model = User

docs/tutorial/5-relationships-and-hyperlinked-apis.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Instead of using a concrete generic view, we'll use the base class for represent
4444
As usual we need to add the new views that we've created in to our URLconf.
4545
We'll add a url pattern for our new API root in `snippets/urls.py`:
4646

47-
url(r'^$', 'api_root'),
47+
url(r'^$', views.api_root),
4848

4949
And then add a url pattern for the snippet highlights:
5050

0 commit comments

Comments
 (0)