aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Christie2012-10-28 19:37:27 +0000
committerTom Christie2012-10-28 19:37:27 +0000
commitdb635fa6327d8d3ac3b06886c5f459b5c5a5cd04 (patch)
tree4aa670b8e7dc6b6e49662c41cc18bce3a0fc0b21
parentfde79376f323708d9f7b80ee830fe63060fb335f (diff)
downloaddjango-rest-framework-db635fa6327d8d3ac3b06886c5f459b5c5a5cd04.tar.bz2
Minor fixes
-rw-r--r--docs/index.md6
-rw-r--r--docs/template.html3
-rw-r--r--docs/tutorial/1-serialization.md6
-rw-r--r--docs/tutorial/2-requests-and-responses.md8
-rw-r--r--docs/tutorial/4-authentication-and-permissions.md2
5 files changed, 12 insertions, 13 deletions
diff --git a/docs/index.md b/docs/index.md
index f66ba7f4..bd0c007d 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -67,9 +67,8 @@ The tutorial will walk you through the building blocks that make up REST framewo
* [1 - Serialization][tut-1]
* [2 - Requests & Responses][tut-2]
* [3 - Class based views][tut-3]
-* [4 - Authentication, permissions & throttling][tut-4]
+* [4 - Authentication & permissions][tut-4]
* [5 - Relationships & hyperlinked APIs][tut-5]
-<!-- * [6 - Resource orientated projects][tut-6]-->
## API Guide
@@ -161,9 +160,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
[tut-1]: tutorial/1-serialization.md
[tut-2]: tutorial/2-requests-and-responses.md
[tut-3]: tutorial/3-class-based-views.md
-[tut-4]: tutorial/4-authentication-permissions-and-throttling.md
+[tut-4]: tutorial/4-authentication-and-permissions.md
[tut-5]: tutorial/5-relationships-and-hyperlinked-apis.md
-[tut-6]: tutorial/6-resource-orientated-projects.md
[request]: api-guide/requests.md
[response]: api-guide/responses.md
diff --git a/docs/template.html b/docs/template.html
index 56c5d832..557b45b3 100644
--- a/docs/template.html
+++ b/docs/template.html
@@ -57,9 +57,8 @@
<li><a href="{{ base_url }}/tutorial/1-serialization{{ suffix }}">1 - Serialization</a></li>
<li><a href="{{ base_url }}/tutorial/2-requests-and-responses{{ suffix }}">2 - Requests and responses</a></li>
<li><a href="{{ base_url }}/tutorial/3-class-based-views{{ suffix }}">3 - Class based views</a></li>
- <li><a href="{{ base_url }}/tutorial/4-authentication-permissions-and-throttling{{ suffix }}">4 - Authentication, permissions and throttling</a></li>
+ <li><a href="{{ base_url }}/tutorial/4-authentication-and-permissions{{ suffix }}">4 - Authentication and permissions</a></li>
<li><a href="{{ base_url }}/tutorial/5-relationships-and-hyperlinked-apis{{ suffix }}">5 - Relationships and hyperlinked APIs</a></li>
- <!-- <li><a href="{{ base_url }}/tutorial/6-resource-orientated-projects{{ suffix }}">6 - Resource orientated projects</a></li> -->
</ul>
</li>
<li class="dropdown">
diff --git a/docs/tutorial/1-serialization.md b/docs/tutorial/1-serialization.md
index fc052202..c1ab49d1 100644
--- a/docs/tutorial/1-serialization.md
+++ b/docs/tutorial/1-serialization.md
@@ -278,13 +278,13 @@ We'll also need a view which corresponds to an individual snippet, and can be us
snippet.delete()
return HttpResponse(status=204)
-Finally we need to wire these views up. Create the `snippet/urls.py` file:
+Finally we need to wire these views up. Create the `snippets/urls.py` file:
from django.conf.urls import patterns, url
urlpatterns = patterns('snippets.views',
- url(r'^snippet/$', 'snippet_list'),
- url(r'^snippet/(?P<pk>[0-9]+)/$', 'snippet_detail')
+ url(r'^snippets/$', 'snippet_list'),
+ url(r'^snippets/(?P<pk>[0-9]+)/$', 'snippet_detail')
)
It's worth noting that there's a couple of edge cases we're not dealing with properly at the moment. If we send malformed `json`, or if a request is made with a method that the view doesn't handle, then we'll end up with a 500 "server error" response. Still, this'll do for now.
diff --git a/docs/tutorial/2-requests-and-responses.md b/docs/tutorial/2-requests-and-responses.md
index 76803d24..938739fa 100644
--- a/docs/tutorial/2-requests-and-responses.md
+++ b/docs/tutorial/2-requests-and-responses.md
@@ -114,8 +114,8 @@ Now update the `urls.py` file slightly, to append a set of `format_suffix_patter
from rest_framework.urlpatterns import format_suffix_patterns
urlpatterns = patterns('snippet.views',
- url(r'^$', 'snippet_list'),
- url(r'^(?P<pk>[0-9]+)$', 'snippet_detail')
+ url(r'^snippets/$', 'snippet_list'),
+ url(r'^snippets/(?P<pk>[0-9]+)$', 'snippet_detail')
)
urlpatterns = format_suffix_patterns(urlpatterns)
@@ -128,7 +128,7 @@ Go ahead and test the API from the command line, as we did in [tutorial part 1][
**TODO: Describe using accept headers, content-type headers, and format suffixed URLs**
-Now go and open the API in a web browser, by visiting [http://127.0.0.1:8000/][devserver]."
+Now go and open the API in a web browser, by visiting [http://127.0.0.1:8000/snippets/][devserver]."
**Note: Right now the Browseable API only works with the CBV's. Need to fix that.**
@@ -144,7 +144,7 @@ See the [browsable api][browseable-api] topic for more information about the bro
In [tutorial part 3][tut-3], we'll start using class based views, and see how generic views reduce the amount of code we need to write.
[json-url]: http://example.com/api/items/4.json
-[devserver]: http://127.0.0.1:8000/
+[devserver]: http://127.0.0.1:8000/snippets/
[browseable-api]: ../topics/browsable-api.md
[tut-1]: 1-serialization.md
[tut-3]: 3-class-based-views.md
diff --git a/docs/tutorial/4-authentication-and-permissions.md b/docs/tutorial/4-authentication-and-permissions.md
index 79436ad4..336d5891 100644
--- a/docs/tutorial/4-authentication-and-permissions.md
+++ b/docs/tutorial/4-authentication-and-permissions.md
@@ -100,6 +100,8 @@ This field is doing something quite interesting. The `source` argument controls
The field we've added is the untyped `Field` class, in contrast to the other typed fields, such as `CharField`, `BooleanField` etc... The untyped `Field` is always read-only, and will be used for serialized representations, but will not be used for updating model instances when they are deserialized.
+**TODO: Explain the SessionAuthentication and BasicAuthentication classes, and demonstrate using HTTP basic authentication with curl requests**
+
## Adding required permissions to views
Now that code snippets are associated with users we want to make sure that only authenticated users are able to create, update and delete code snippets.