From c678a1f118ea65fc1d13c40ef1a083577fdd5381 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Thu, 18 Dec 2014 13:49:50 +0000 Subject: Update documentation --- tutorial/1-serialization/index.html | 4 ++++ tutorial/2-requests-and-responses/index.html | 4 ++++ tutorial/3-class-based-views/index.html | 4 ++++ tutorial/4-authentication-and-permissions/index.html | 4 ++++ tutorial/5-relationships-and-hyperlinked-apis/index.html | 4 ++++ tutorial/6-viewsets-and-routers/index.html | 8 ++++++-- tutorial/quickstart/index.html | 4 ++++ 7 files changed, 30 insertions(+), 2 deletions(-) (limited to 'tutorial') diff --git a/tutorial/1-serialization/index.html b/tutorial/1-serialization/index.html index 0561fab1..7cb478bd 100644 --- a/tutorial/1-serialization/index.html +++ b/tutorial/1-serialization/index.html @@ -251,6 +251,10 @@ Contributing to REST framework +
  • + Project management +
  • +
  • 2.0 Announcement
  • diff --git a/tutorial/2-requests-and-responses/index.html b/tutorial/2-requests-and-responses/index.html index e9436d2a..f117a9d3 100644 --- a/tutorial/2-requests-and-responses/index.html +++ b/tutorial/2-requests-and-responses/index.html @@ -251,6 +251,10 @@ Contributing to REST framework +
  • + Project management +
  • +
  • 2.0 Announcement
  • diff --git a/tutorial/3-class-based-views/index.html b/tutorial/3-class-based-views/index.html index cf7be3ae..6533945d 100644 --- a/tutorial/3-class-based-views/index.html +++ b/tutorial/3-class-based-views/index.html @@ -251,6 +251,10 @@ Contributing to REST framework +
  • + Project management +
  • +
  • 2.0 Announcement
  • diff --git a/tutorial/4-authentication-and-permissions/index.html b/tutorial/4-authentication-and-permissions/index.html index f4661bde..21e181c5 100644 --- a/tutorial/4-authentication-and-permissions/index.html +++ b/tutorial/4-authentication-and-permissions/index.html @@ -251,6 +251,10 @@ Contributing to REST framework +
  • + Project management +
  • +
  • 2.0 Announcement
  • diff --git a/tutorial/5-relationships-and-hyperlinked-apis/index.html b/tutorial/5-relationships-and-hyperlinked-apis/index.html index 51a66e92..e552c6e4 100644 --- a/tutorial/5-relationships-and-hyperlinked-apis/index.html +++ b/tutorial/5-relationships-and-hyperlinked-apis/index.html @@ -251,6 +251,10 @@ Contributing to REST framework +
  • + Project management +
  • +
  • 2.0 Announcement
  • diff --git a/tutorial/6-viewsets-and-routers/index.html b/tutorial/6-viewsets-and-routers/index.html index 04071f9e..03839e8d 100644 --- a/tutorial/6-viewsets-and-routers/index.html +++ b/tutorial/6-viewsets-and-routers/index.html @@ -251,6 +251,10 @@ Contributing to REST framework +
  • + Project management +
  • +
  • 2.0 Announcement
  • @@ -423,8 +427,8 @@ class SnippetViewSet(viewsets.ModelViewSet): snippet = self.get_object() return Response(snippet.highlighted) - def pre_save(self, obj): - obj.owner = self.request.user + def perform_create(self, serializer): + serializer.save(owner=self.request.user)

    This time we've used the ModelViewSet class in order to get the complete set of default read and write operations.

    Notice that we've also used the @detail_route decorator to create a custom action, named highlight. This decorator can be used to add any custom endpoints that don't fit into the standard create/update/delete style.

    diff --git a/tutorial/quickstart/index.html b/tutorial/quickstart/index.html index b81e1dc4..0c593f47 100644 --- a/tutorial/quickstart/index.html +++ b/tutorial/quickstart/index.html @@ -251,6 +251,10 @@ Contributing to REST framework +
  • + Project management +
  • +
  • 2.0 Announcement
  • -- cgit v1.2.3