Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
71c49fea
Commit
71c49fea
authored
Dec 06, 2014
by
Tom Christie
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2219 from linovia/bugfix/tutorial_2
Update the tutorial against DRF v3 (part 4 & 5)
parents
544967f3
e4820d61
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
docs/tutorial/4-authentication-and-permissions.md
+2
-2
docs/tutorial/5-relationships-and-hyperlinked-apis.md
+1
-1
No files found.
docs/tutorial/4-authentication-and-permissions.md
View file @
71c49fea
...
@@ -43,7 +43,7 @@ And now we can add a `.save()` method to our model class:
...
@@ -43,7 +43,7 @@ And now we can add a `.save()` method to our model class:
When that's all done we'll need to update our database tables.
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.
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.
rm
tmp.db
rm
-f tmp.db db.sqlite3
rm -r snippets/migrations
rm -r snippets/migrations
python manage.py makemigrations snippets
python manage.py makemigrations snippets
python manage.py migrate
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
...
@@ -59,7 +59,7 @@ Now that we've got some users to work with, we'd better add representations of t
from django.contrib.auth.models import User
from django.contrib.auth.models import User
class UserSerializer(serializers.ModelSerializer):
class UserSerializer(serializers.ModelSerializer):
snippets = serializers.PrimaryKeyRelatedField(many=True)
snippets = serializers.PrimaryKeyRelatedField(many=True
, queryset=Snippet.objects.all()
)
class Meta:
class Meta:
model = User
model = User
...
...
docs/tutorial/5-relationships-and-hyperlinked-apis.md
View file @
71c49fea
...
@@ -44,7 +44,7 @@ Instead of using a concrete generic view, we'll use the base class for represent
...
@@ -44,7 +44,7 @@ Instead of using a concrete generic view, we'll use the base class for represent
As usual we need to add the new views that we've created in to our URLconf.
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
`snippets/urls.py`
:
We'll add a url pattern for our new API root in
`snippets/urls.py`
:
url(r'^$',
'api_root'
),
url(r'^$',
views.api_root
),
And then add a url pattern for the snippet highlights:
And then add a url pattern for the snippet highlights:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment