mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-02 20:54:42 +03:00
Viewsets and routers in seperate docs
This commit is contained in:
parent
371698331c
commit
027792c981
27
docs/api-guide/routers.md
Normal file
27
docs/api-guide/routers.md
Normal file
|
@ -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.
|
||||
>
|
||||
> — [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
|
|
@ -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.
|
||||
>
|
||||
> — [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
|
||||
|
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue
Block a user