Commit 027792c9 by Tom Christie

Viewsets and routers in seperate docs

parent 37169833
<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
<a class="github" href="routers.py"></a> <a class="github" href="viewsets.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.
# ViewSets # ViewSets
......
...@@ -86,7 +86,7 @@ The tutorial will walk you through the building blocks that make up REST framewo ...@@ -86,7 +86,7 @@ The tutorial will walk you through the building blocks that make up REST framewo
* [3 - Class based views][tut-3] * [3 - Class based views][tut-3]
* [4 - Authentication & permissions][tut-4] * [4 - Authentication & permissions][tut-4]
* [5 - Relationships & hyperlinked APIs][tut-5] * [5 - Relationships & hyperlinked APIs][tut-5]
* [6 - ViewSets & Routers][tut-6] * [6 - Viewsets & routers][tut-6]
## API Guide ## API Guide
...@@ -96,7 +96,8 @@ The API guide is your complete reference manual to all the functionality provide ...@@ -96,7 +96,8 @@ The API guide is your complete reference manual to all the functionality provide
* [Responses][response] * [Responses][response]
* [Views][views] * [Views][views]
* [Generic views][generic-views] * [Generic views][generic-views]
* [ViewSets and Routers][viewsets-routers] * [Viewsets][viewsets]
* [Routers][routers]
* [Parsers][parsers] * [Parsers][parsers]
* [Renderers][renderers] * [Renderers][renderers]
* [Serializers][serializers] * [Serializers][serializers]
...@@ -205,7 +206,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ...@@ -205,7 +206,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
[response]: api-guide/responses.md [response]: api-guide/responses.md
[views]: api-guide/views.md [views]: api-guide/views.md
[generic-views]: api-guide/generic-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 [parsers]: api-guide/parsers.md
[renderers]: api-guide/renderers.md [renderers]: api-guide/renderers.md
[serializers]: api-guide/serializers.md [serializers]: api-guide/serializers.md
......
...@@ -62,7 +62,7 @@ ...@@ -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/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/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/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> </ul>
</li> </li>
<li class="dropdown"> <li class="dropdown">
...@@ -72,7 +72,8 @@ ...@@ -72,7 +72,8 @@
<li><a href="{{ base_url }}/api-guide/responses{{ suffix }}">Responses</a></li> <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/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/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/parsers{{ suffix }}">Parsers</a></li>
<li><a href="{{ base_url }}/api-guide/renderers{{ suffix }}">Renderers</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> <li><a href="{{ base_url }}/api-guide/serializers{{ suffix }}">Serializers</a></li>
......
...@@ -52,7 +52,8 @@ path_list = [ ...@@ -52,7 +52,8 @@ path_list = [
'api-guide/responses.md', 'api-guide/responses.md',
'api-guide/views.md', 'api-guide/views.md',
'api-guide/generic-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/parsers.md',
'api-guide/renderers.md', 'api-guide/renderers.md',
'api-guide/serializers.md', 'api-guide/serializers.md',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment