From 58b5e8682788fbfee83b2e8d9c79a96f580da429 Mon Sep 17 00:00:00 2001 From: Ian MacLeod Date: Tue, 17 Nov 2015 11:10:52 -0800 Subject: [PATCH 1/3] Removed missing 'url' property from User fields. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b5b33212d..e2510f26d 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ from rest_framework import serializers, viewsets, routers class UserSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = User - fields = ('url', 'username', 'email', 'is_staff') + fields = ('username', 'email', 'is_staff') # ViewSets define the view behavior. From 9c7411cfc1ae09babe9d1e35e8567dc4a3a2bf7c Mon Sep 17 00:00:00 2001 From: Ian MacLeod Date: Tue, 17 Nov 2015 16:21:08 -0800 Subject: [PATCH 2/3] Put 'url' field back in to UserSerializer example, added warning about using namespace when including router urls. --- README.md | 2 +- docs/index.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e2510f26d..b5b33212d 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ from rest_framework import serializers, viewsets, routers class UserSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = User - fields = ('username', 'email', 'is_staff') + fields = ('url', 'username', 'email', 'is_staff') # ViewSets define the view behavior. diff --git a/docs/index.md b/docs/index.md index edfae2ad8..206764ae3 100644 --- a/docs/index.md +++ b/docs/index.md @@ -135,7 +135,7 @@ Here's our project's root `urls.py` module: url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')) ] -You can now open the API in your browser at [http://127.0.0.1:8000/](http://127.0.0.1:8000/), and view your new 'users' API. If you use the login control in the top right corner you'll also be able to add, create and delete users from the system. +Do not use a namespace when you include your router urls as they are not currently supported. You can now open the API in your browser at [http://127.0.0.1:8000/](http://127.0.0.1:8000/), and view your new 'users' API. If you use the login control in the top right corner you'll also be able to add, create and delete users from the system. ## Quickstart From f1c5e197ec23dfa6a0819fec9a92c3f928400b3b Mon Sep 17 00:00:00 2001 From: Ian MacLeod Date: Tue, 17 Nov 2015 17:50:05 -0800 Subject: [PATCH 3/3] Improved example documentation regarding router includes to avoid common new user use-case with namespaces. --- docs/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.md b/docs/index.md index 206764ae3..97f397558 100644 --- a/docs/index.md +++ b/docs/index.md @@ -135,7 +135,7 @@ Here's our project's root `urls.py` module: url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')) ] -Do not use a namespace when you include your router urls as they are not currently supported. You can now open the API in your browser at [http://127.0.0.1:8000/](http://127.0.0.1:8000/), and view your new 'users' API. If you use the login control in the top right corner you'll also be able to add, create and delete users from the system. +If you choose to use a namespace when including your router urls you will need to do some additional work, as documented in [Using include with routers](http://www.django-rest-framework.org/api-guide/routers/#using-include-with-routers). You can now open the API in your browser at [http://127.0.0.1:8000/](http://127.0.0.1:8000/), and view your new 'users' API. If you use the login control in the top right corner you'll also be able to add, create and delete users from the system. ## Quickstart