aboutsummaryrefslogtreecommitdiffstats
path: root/docs/api-guide
diff options
context:
space:
mode:
authorTom Christie2013-04-09 11:54:51 +0100
committerTom Christie2013-04-09 11:54:51 +0100
commit027792c981b1442a018e382a6fa2e58496b0b750 (patch)
treec53fd735ae3dd7a5d941be63a71432c072940d76 /docs/api-guide
parent371698331c979305b5684f864ee6bf5b6d11a44e (diff)
downloaddjango-rest-framework-027792c981b1442a018e382a6fa2e58496b0b750.tar.bz2
Viewsets and routers in seperate docs
Diffstat (limited to 'docs/api-guide')
-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
2 files changed, 28 insertions, 13 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