Skip to content

Tweaked a few issues in the tutorial documentation. #2397

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 10, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/tutorial/1-serialization.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ Our `SnippetSerializer` class is replicating a lot of information that's also co
In the same way that Django provides both `Form` classes and `ModelForm` classes, REST framework includes both `Serializer` classes, and `ModelSerializer` classes.

Let's look at refactoring our serializer using the `ModelSerializer` class.
Open the file `snippets/serializers.py` again, and edit the `SnippetSerializer` class.
Open the file `snippets/serializers.py` again, and replace the `SnippetSerializer` class with the following.

class SnippetSerializer(serializers.ModelSerializer):
class Meta:
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial/3-class-based-views.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ That's looking good. Again, it's still pretty similar to the function based vie

We'll also need to refactor our `urls.py` slightly now we're using class based views.

from django.conf.urls import patterns, url
from django.conf.urls import url
from rest_framework.urlpatterns import format_suffix_patterns
from snippets import views

Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial/4-authentication-and-permissions.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ In the snippets app, create a new file, `permissions.py`
# Write permissions are only allowed to the owner of the snippet.
return obj.owner == request.user

Now we can add that custom permission to our snippet instance endpoint, by editing the `permission_classes` property on the `SnippetDetail` class:
Now we can add that custom permission to our snippet instance endpoint, by editing the `permission_classes` property on the `SnippetDetail` view class:

permission_classes = (permissions.IsAuthenticatedOrReadOnly,
IsOwnerOrReadOnly,)
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/5-relationships-and-hyperlinked-apis.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ If we're going to have a hyperlinked API, we need to make sure we name our URL p

After adding all those names into our URLconf, our final `snippets/urls.py` file should look something like this:

from django.conf.urls import url, include
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think here we should be adding all imports since we are saying "this is how it should be looking"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to agree... If that's the case, a few other samples show a diff, versus all imports. While I was going through the samples, I would copy/paste and review in my text editor. So it was difficult when diffs were provided. Anyone else have opinions?


# API endpoints
urlpatterns = format_suffix_patterns([
url(r'^$', views.api_root),
Expand Down