aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/api-guide/routers.md27
-rw-r--r--docs/api-guide/viewsets.md (renamed from docs/api-guide/viewsets-routers.md)14
-rw-r--r--docs/index.md8
-rw-r--r--docs/template.html5
-rwxr-xr-xmkdocs.py3
5 files changed, 38 insertions, 19 deletions
diff --git a/docs/api-guide/routers.md b/docs/api-guide/routers.md
new file mode 100644
index 00000000..dbb352fe
--- /dev/null
+++ b/docs/api-guide/routers.md
@@ -0,0 +1,27 @@
+<a class="github" href="routers.py"></a>
+
+# Routers
+
+> Resource routing allows you to quickly declare all of the common routes for a given resourceful controller. Instead of declaring separate routes for your index... a resourceful route declares them in a single line of code.
+>
+> &mdash; [Ruby on Rails Documentation][cite]
+
+Some Web frameworks such as Rails provide functionality for automatically determining how the URLs for an application should be mapped to the logic that deals with handling incoming requests.
+
+Conversely, Django stops short of automatically generating URLs, and requires you to explicitly manage your URL configuration.
+
+REST framework adds support for automatic URL routing, which provides you with a simple, quick and consistent way of wiring your view logic to a set of URLs.
+
+# API Guide
+
+Routers provide a convenient and simple shortcut for wiring up your application's URLs.
+
+ router = routers.DefaultRouter()
+ router.register('^/', APIRoot, 'api-root')
+ router.register('^users/', UserViewSet, 'user')
+ router.register('^groups/', GroupViewSet, 'group')
+ router.register('^accounts/', AccountViewSet, 'account')
+
+ urlpatterns = router.urlpatterns
+
+[cite]: http://guides.rubyonrails.org/routing.html \ No newline at end of file
diff --git a/docs/api-guide/viewsets-routers.md b/docs/api-guide/viewsets.md
index 7813c00d..83b486dd 100644
--- a/docs/api-guide/viewsets-routers.md
+++ b/docs/api-guide/viewsets.md
@@ -1,16 +1,4 @@
-<a class="github" href="routers.py"></a> <a class="github" href="viewsets.py"></a>
-
-# ViewSets & Routers
-
-> Resource routing allows you to quickly declare all of the common routes for a given resourceful controller. Instead of declaring separate routes for your index... a resourceful route declares them in a single line of code.
->
-> &mdash; [Ruby on Rails Documentation][cite]
-
-Some Web frameworks such as Rails provide functionality for automatically determining how the URLs for an application should be mapped to the logic that deals with handling incoming requests.
-
-Conversely, Django stops short of automatically generating URLs, and requires you to explicitly manage your URL configuration.
-
-REST framework adds support for automatic URL routing, which provides you with a simple, quick and consistent way of wiring your view logic to a set of URLs.
+<a class="github" href="viewsets.py"></a>
# ViewSets
diff --git a/docs/index.md b/docs/index.md
index 469a5885..d51bbe13 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -86,7 +86,7 @@ The tutorial will walk you through the building blocks that make up REST framewo
* [3 - Class based views][tut-3]
* [4 - Authentication & permissions][tut-4]
* [5 - Relationships & hyperlinked APIs][tut-5]
-* [6 - ViewSets & Routers][tut-6]
+* [6 - Viewsets & routers][tut-6]
## API Guide
@@ -96,7 +96,8 @@ The API guide is your complete reference manual to all the functionality provide
* [Responses][response]
* [Views][views]
* [Generic views][generic-views]
-* [ViewSets and Routers][viewsets-routers]
+* [Viewsets][viewsets]
+* [Routers][routers]
* [Parsers][parsers]
* [Renderers][renderers]
* [Serializers][serializers]
@@ -205,7 +206,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
[response]: api-guide/responses.md
[views]: api-guide/views.md
[generic-views]: api-guide/generic-views.md
-[viewsets-routers]: api-guide/viewsets-routers.md
+[viewsets]: api-guide/viewsets.md
+[routers]: api-guide/routers.md
[parsers]: api-guide/parsers.md
[renderers]: api-guide/renderers.md
[serializers]: api-guide/serializers.md
diff --git a/docs/template.html b/docs/template.html
index aec3ecc9..931e51c7 100644
--- a/docs/template.html
+++ b/docs/template.html
@@ -62,7 +62,7 @@
<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-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-viewsets-and-routers{{ suffix }}">6 - ViewSets and Routers</a></li>
+ <li><a href="{{ base_url }}/tutorial/6-viewsets-and-routers{{ suffix }}">6 - Viewsets and routers</a></li>
</ul>
</li>
<li class="dropdown">
@@ -72,7 +72,8 @@
<li><a href="{{ base_url }}/api-guide/responses{{ suffix }}">Responses</a></li>
<li><a href="{{ base_url }}/api-guide/views{{ suffix }}">Views</a></li>
<li><a href="{{ base_url }}/api-guide/generic-views{{ suffix }}">Generic views</a></li>
- <li><a href="{{ base_url }}/api-guide/viewsets-routers{{ suffix }}">ViewSets and Routers</a></li>
+ <li><a href="{{ base_url }}/api-guide/viewsets{{ suffix }}">Viewsets</a></li>
+ <li><a href="{{ base_url }}/api-guide/routers{{ suffix }}">Routers</a></li>
<li><a href="{{ base_url }}/api-guide/parsers{{ suffix }}">Parsers</a></li>
<li><a href="{{ base_url }}/api-guide/renderers{{ suffix }}">Renderers</a></li>
<li><a href="{{ base_url }}/api-guide/serializers{{ suffix }}">Serializers</a></li>
diff --git a/mkdocs.py b/mkdocs.py
index f6cc2b5a..a13870d1 100755
--- a/mkdocs.py
+++ b/mkdocs.py
@@ -52,7 +52,8 @@ path_list = [
'api-guide/responses.md',
'api-guide/views.md',
'api-guide/generic-views.md',
- 'api-guide/viewsets-routers.md',
+ 'api-guide/viewsets.md',
+ 'api-guide/routers.md',
'api-guide/parsers.md',
'api-guide/renderers.md',
'api-guide/serializers.md',