diff options
| author | sshquack | 2014-08-15 20:45:28 -0600 | 
|---|---|---|
| committer | sshquack | 2014-08-15 20:45:28 -0600 | 
| commit | 867e441ec07fc182569c3dbe6f86fe42aa6b0cbf (patch) | |
| tree | abed866613809f8efe96d03dac3e8d1dffb950d8 /docs/tutorial/5-relationships-and-hyperlinked-apis.md | |
| parent | 14867705e90b2b5f7e84dc7385d4ffba0c82b3e1 (diff) | |
| download | django-rest-framework-867e441ec07fc182569c3dbe6f86fe42aa6b0cbf.tar.bz2 | |
Strip trailing spaces in tutorial
Diffstat (limited to 'docs/tutorial/5-relationships-and-hyperlinked-apis.md')
| -rw-r--r-- | docs/tutorial/5-relationships-and-hyperlinked-apis.md | 16 | 
1 files changed, 8 insertions, 8 deletions
| diff --git a/docs/tutorial/5-relationships-and-hyperlinked-apis.md b/docs/tutorial/5-relationships-and-hyperlinked-apis.md index deddb13f..9c61fe3d 100644 --- a/docs/tutorial/5-relationships-and-hyperlinked-apis.md +++ b/docs/tutorial/5-relationships-and-hyperlinked-apis.md @@ -1,6 +1,6 @@  # Tutorial 5: Relationships & Hyperlinked APIs -At the moment relationships within our API are represented by using primary keys.  In this part of the tutorial we'll improve the cohesion and discoverability of our API, by instead using hyperlinking for relationships.  +At the moment relationships within our API are represented by using primary keys.  In this part of the tutorial we'll improve the cohesion and discoverability of our API, by instead using hyperlinking for relationships.  ## Creating an endpoint for the root of our API @@ -37,7 +37,7 @@ Instead of using a concrete generic view, we'll use the base class for represent      class SnippetHighlight(generics.GenericAPIView):          queryset = Snippet.objects.all()          renderer_classes = (renderers.StaticHTMLRenderer,) -     +          def get(self, request, *args, **kwargs):              snippet = self.get_object()              return Response(snippet.highlighted) @@ -78,16 +78,16 @@ We can easily re-write our existing serializers to use hyperlinking. In your `sn      class SnippetSerializer(serializers.HyperlinkedModelSerializer):          owner = serializers.Field(source='owner.username')          highlight = serializers.HyperlinkedIdentityField(view_name='snippet-highlight', format='html') -     +          class Meta:              model = Snippet              fields = ('url', 'highlight', 'owner',                        'title', 'code', 'linenos', 'language', 'style') -     -     + +      class UserSerializer(serializers.HyperlinkedModelSerializer):          snippets = serializers.HyperlinkedRelatedField(many=True, view_name='snippet-detail') -     +          class Meta:              model = User              fields = ('url', 'username', 'snippets') @@ -126,9 +126,9 @@ After adding all those names into our URLconf, our final `snippets/urls.py` file              views.UserDetail.as_view(),              name='user-detail')      )) -     +      # Login and logout views for the browsable API -    urlpatterns += patterns('',     +    urlpatterns += patterns('',          url(r'^api-auth/', include('rest_framework.urls',                                     namespace='rest_framework')),      ) | 
