mirror of
https://github.com/encode/django-rest-framework.git
synced 2026-01-15 04:48:47 +03:00
Update documentation
This commit is contained in:
parent
8a0f235e1a
commit
ebab87c693
377
404.html
377
404.html
|
|
@ -4,18 +4,18 @@
|
|||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta charset="utf-8">
|
||||
<title>Django REST framework - 404 - Page not found</title>
|
||||
<link href="http://www.django-rest-framework.org/img/favicon.ico" rel="icon" type="image/x-icon">
|
||||
<link rel="canonical" href="http://www.django-rest-framework.org/404" />
|
||||
<title>Django REST framework</title>
|
||||
<link href="./img/favicon.ico" rel="icon" type="image/x-icon">
|
||||
<link rel="canonical" href="" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="Django, API, REST, 404 - Page not found">
|
||||
<meta name="description" content="Django, API, REST">
|
||||
<meta name="author" content="Tom Christie">
|
||||
|
||||
<!-- Le styles -->
|
||||
<link href="http://www.django-rest-framework.org/css/prettify.css" rel="stylesheet">
|
||||
<link href="http://www.django-rest-framework.org/css/bootstrap.css" rel="stylesheet">
|
||||
<link href="http://www.django-rest-framework.org/css/bootstrap-responsive.css" rel="stylesheet">
|
||||
<link href="http://www.django-rest-framework.org/css/default.css" rel="stylesheet">
|
||||
<link href="./css/prettify.css" rel="stylesheet">
|
||||
<link href="./css/bootstrap.css" rel="stylesheet">
|
||||
<link href="./css/bootstrap-responsive.css" rel="stylesheet">
|
||||
<link href="./css/default.css" rel="stylesheet">
|
||||
|
||||
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
|
||||
<!--[if lt IE 9]>
|
||||
|
|
@ -36,19 +36,39 @@
|
|||
s.parentNode.insertBefore(ga, s);
|
||||
})();
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body onload="prettyPrint()" class="404-page">
|
||||
<style>
|
||||
span.fusion-wrap a {
|
||||
display: block;
|
||||
margin-top: 10px;
|
||||
color: black;
|
||||
}
|
||||
a.fusion-poweredby {
|
||||
display: block;
|
||||
margin-top: 10px;
|
||||
}
|
||||
@media (max-width: 767px) {
|
||||
div.promo {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body onload="prettyPrint()" class="-page">
|
||||
|
||||
<div class="wrapper">
|
||||
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container-fluid">
|
||||
<a class="repo-link btn btn-primary btn-small" href="https://github.com/tomchristie/django-rest-framework/tree/master">GitHub</a>
|
||||
<a class="repo-link btn btn-inverse btn-small disabled" href="#">Next <i class="icon-arrow-right icon-white"></i></a>
|
||||
<a class="repo-link btn btn-inverse btn-small disabled" href="#"><i class="icon-arrow-left icon-white"></i> Previous</a>
|
||||
<a class="repo-link btn btn-inverse btn-small" href="#searchModal" data-toggle="modal"><i class="icon-search icon-white"></i> Search</a>
|
||||
<a class="repo-link btn btn-inverse btn-small disabled" rel="prev" >
|
||||
Next <i class="icon-arrow-right icon-white"></i>
|
||||
</a>
|
||||
<a class="repo-link btn btn-inverse btn-small disabled" rel="next" >
|
||||
<i class="icon-arrow-left icon-white"></i> Previous
|
||||
</a>
|
||||
<a id="search_modal_show" class="repo-link btn btn-inverse btn-small" href="#mkdocs_search_modal" data-toggle="modal" data-target="#mkdocs_search_modal"><i class="icon-search icon-white"></i> Search</a>
|
||||
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
|
|
@ -56,116 +76,286 @@
|
|||
</a>
|
||||
<a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
|
||||
<div class="nav-collapse collapse">
|
||||
<ul class="nav">
|
||||
<li><a href="http://www.django-rest-framework.org">Home</a></li>
|
||||
|
||||
<!-- Main navigation -->
|
||||
<ul class="nav navbar-nav">
|
||||
|
||||
<li >
|
||||
<a href=".">Home</a>
|
||||
</li>
|
||||
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Tutorial <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="http://www.django-rest-framework.org/tutorial/quickstart">Quickstart</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/tutorial/1-serialization">1 - Serialization</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/tutorial/2-requests-and-responses">2 - Requests and responses</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/tutorial/3-class-based-views">3 - Class based views</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/tutorial/4-authentication-and-permissions">4 - Authentication and permissions</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/tutorial/5-relationships-and-hyperlinked-apis">5 - Relationships and hyperlinked APIs</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/tutorial/6-viewsets-and-routers">6 - Viewsets and routers</a></li>
|
||||
|
||||
<li >
|
||||
<a href="tutorial/quickstart/">Quickstart</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="tutorial/1-serialization/">1 - Serialization</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="tutorial/2-requests-and-responses/">2 - Requests and responses</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="tutorial/3-class-based-views/">3 - Class based views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="tutorial/4-authentication-and-permissions/">4 - Authentication and permissions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="tutorial/5-relationships-and-hyperlinked-apis/">5 - Relationships and hyperlinked APIs</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="tutorial/6-viewsets-and-routers/">6 - Viewsets and routers</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">API Guide <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="http://www.django-rest-framework.org/api-guide/requests">Requests</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/api-guide/responses">Responses</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/api-guide/views">Views</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/api-guide/generic-views">Generic views</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/api-guide/viewsets">Viewsets</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/api-guide/routers">Routers</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/api-guide/parsers">Parsers</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/api-guide/renderers">Renderers</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/api-guide/serializers">Serializers</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/api-guide/fields">Serializer fields</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/api-guide/relations">Serializer relations</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/api-guide/authentication">Authentication</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/api-guide/permissions">Permissions</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/api-guide/throttling">Throttling</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/api-guide/filtering">Filtering</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/api-guide/pagination">Pagination</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/api-guide/content-negotiation">Content negotiation</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/api-guide/format-suffixes">Format suffixes</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/api-guide/reverse">Returning URLs</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/api-guide/exceptions">Exceptions</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/api-guide/status-codes">Status codes</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/api-guide/testing">Testing</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/api-guide/settings">Settings</a></li>
|
||||
|
||||
<li >
|
||||
<a href="api-guide/requests/">Requests</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="api-guide/responses/">Responses</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="api-guide/views/">Views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="api-guide/generic-views/">Generic views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="api-guide/viewsets/">Viewsets</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="api-guide/routers/">Routers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="api-guide/parsers/">Parsers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="api-guide/renderers/">Renderers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="api-guide/serializers/">Serializers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="api-guide/fields/">Serializer fields</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="api-guide/relations/">Serializer relations</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="api-guide/validators/">Validators</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="api-guide/authentication/">Authentication</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="api-guide/permissions/">Permissions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="api-guide/throttling/">Throttling</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="api-guide/filtering/">Filtering</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="api-guide/pagination/">Pagination</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="api-guide/versioning/">Versioning</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="api-guide/content-negotiation/">Content negotiation</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="api-guide/metadata/">Metadata</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="api-guide/format-suffixes/">Format suffixes</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="api-guide/reverse/">Returning URLs</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="api-guide/exceptions/">Exceptions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="api-guide/status-codes/">Status codes</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="api-guide/testing/">Testing</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="api-guide/settings/">Settings</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Topics <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="http://www.django-rest-framework.org/topics/documenting-your-api">Documenting your API</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/topics/ajax-csrf-cors">AJAX, CSRF & CORS</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/topics/browser-enhancements">Browser enhancements</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/topics/browsable-api">The Browsable API</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/topics/rest-hypermedia-hateoas">REST, Hypermedia & HATEOAS</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/topics/rest-framework-2-announcement">2.0 Announcement</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/topics/2.2-announcement">2.2 Announcement</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/topics/2.3-announcement">2.3 Announcement</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/topics/release-notes">Release Notes</a></li>
|
||||
<li><a href="http://www.django-rest-framework.org/topics/credits">Credits</a></li>
|
||||
|
||||
<li >
|
||||
<a href="topics/documenting-your-api/">Documenting your API</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="topics/internationalization/">Internationalization</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="topics/browser-enhancements/">Browser Enhancements</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="topics/browsable-api/">The Browsable API</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="topics/third-party-resources/">Third Party Resources</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="topics/contributing/">Contributing to REST framework</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="topics/project-management/">Project management</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="topics/3.0-announcement/">3.0 Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="topics/3.1-announcement/">3.1 Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="topics/kickstarter-announcement/">Kickstarter Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="topics/release-notes/">Release Notes</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
<ul class="nav pull-right">
|
||||
<!-- TODO
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Version: 2.0.0 <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="#">Trunk</a></li>
|
||||
<li><a href="#">2.0.0</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
-->
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<!--/.nav-collapse -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="body-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- Search Modal -->
|
||||
<div id="searchModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div id="mkdocs_search_modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3 id="myModalLabel">Documentation search</h3>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<!-- Custom google search -->
|
||||
<script>
|
||||
(function() {
|
||||
var cx = '015016005043623903336:rxraeohqk6w';
|
||||
var gcse = document.createElement('script');
|
||||
gcse.type = 'text/javascript';
|
||||
gcse.async = true;
|
||||
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
|
||||
'//www.google.com/cse/cse.js?cx=' + cx;
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(gcse, s);
|
||||
})();
|
||||
</script>
|
||||
<gcse:search></gcse:search>
|
||||
<form role="form">
|
||||
<div class="form-group">
|
||||
<input type="text" name="q" class="form-control" placeholder="Search..." id="mkdocs-search-query">
|
||||
</div>
|
||||
</form>
|
||||
<div id="mkdocs-search-results"></div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row-fluid">
|
||||
<div id="main-content" class="span12">
|
||||
<h1 id="404-page-not-found" style="text-align: center">404</h1>
|
||||
<p style="text-align: center"><strong>Page not found</strong>
|
||||
|
||||
<div class="span3">
|
||||
<!-- TODO
|
||||
<p style="margin-top: -12px">
|
||||
<a class="btn btn-mini btn-primary" style="width: 60px">« previous</a>
|
||||
<a class="btn btn-mini btn-primary" style="float: right; margin-right: 8px; width: 60px;">next »</a>
|
||||
</p>
|
||||
<p style="text-align: center">Try the <a href="http://www.django-rest-framework.org/">homepage</a>, or <a href="#searchModal" data-toggle="modal">search the documentation</a>.</p>
|
||||
-->
|
||||
<div id="table-of-contents">
|
||||
<ul class="nav nav-list side-nav well sidebar-nav-fixed">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="main-content" class="span9">
|
||||
|
||||
|
||||
|
||||
<h1 id="404-page-not-found" style="text-align: center">404</h1>
|
||||
<p style="text-align: center"><strong>Page not found</strong></p>
|
||||
<p style="text-align: center">Try the <a href="http://www.django-rest-framework.org/">homepage</a>, or <a href="#searchModal" data-toggle="modal">search the documentation</a>.</p>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!--/span-->
|
||||
</div>
|
||||
|
|
@ -174,22 +364,25 @@
|
|||
<!--/.fluid-container-->
|
||||
</div>
|
||||
<!--/.body content-->
|
||||
|
||||
<div id="push"></div>
|
||||
</div>
|
||||
<!--/.wrapper -->
|
||||
|
||||
<footer class="span12">
|
||||
<p>Sponsored by <a href="http://dabapps.com/">DabApps</a>.</a>
|
||||
<p>Documentation built with <a href="http://www.mkdocs.org/">MkDocs</a>.</a>
|
||||
</p>
|
||||
</footer>
|
||||
|
||||
<!-- Le javascript
|
||||
================================================== -->
|
||||
================================================== -->
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="http://www.django-rest-framework.org/js/jquery-1.8.1-min.js"></script>
|
||||
<script src="http://www.django-rest-framework.org/js/prettify-1.0.js"></script>
|
||||
<script src="http://www.django-rest-framework.org/js/bootstrap-2.1.1-min.js"></script>
|
||||
<script src="./js/jquery-1.8.1-min.js"></script>
|
||||
<script src="./js/prettify-1.0.js"></script>
|
||||
<script src="./js/bootstrap-2.1.1-min.js"></script>
|
||||
<script>var base_url = '.';</script>
|
||||
<script src="./mkdocs/js/require.js"></script>
|
||||
<script src="./js/theme.js"></script>
|
||||
|
||||
<script>
|
||||
//$('.side-nav').scrollspy()
|
||||
var shiftWindow = function() {
|
||||
|
|
|
|||
|
|
@ -62,13 +62,13 @@
|
|||
<div class="navbar-inner">
|
||||
<div class="container-fluid">
|
||||
<a class="repo-link btn btn-primary btn-small" href="https://github.com/tomchristie/django-rest-framework/tree/master">GitHub</a>
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../permissions">
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../permissions/">
|
||||
Next <i class="icon-arrow-right icon-white"></i>
|
||||
</a>
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../validators">
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../validators/">
|
||||
<i class="icon-arrow-left icon-white"></i> Previous
|
||||
</a>
|
||||
<a class="repo-link btn btn-inverse btn-small" href="#searchModal" data-toggle="modal"><i class="icon-search icon-white"></i> Search</a>
|
||||
<a id="search_modal_show" class="repo-link btn btn-inverse btn-small" href="#mkdocs_search_modal" data-toggle="modal" data-target="#mkdocs_search_modal"><i class="icon-search icon-white"></i> Search</a>
|
||||
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
|
|
@ -79,38 +79,41 @@
|
|||
|
||||
<!-- Main navigation -->
|
||||
<ul class="nav navbar-nav">
|
||||
<li ><a href="/">Home</a></li>
|
||||
|
||||
<li >
|
||||
<a href="../..">Home</a>
|
||||
</li>
|
||||
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Tutorial <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/quickstart">Quickstart</a>
|
||||
<a href="../../tutorial/quickstart/">Quickstart</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/1-serialization">1 - Serialization</a>
|
||||
<a href="../../tutorial/1-serialization/">1 - Serialization</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/2-requests-and-responses">2 - Requests and responses</a>
|
||||
<a href="../../tutorial/2-requests-and-responses/">2 - Requests and responses</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/3-class-based-views">3 - Class based views</a>
|
||||
<a href="../../tutorial/3-class-based-views/">3 - Class based views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/4-authentication-and-permissions">4 - Authentication and permissions</a>
|
||||
<a href="../../tutorial/4-authentication-and-permissions/">4 - Authentication and permissions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/5-relationships-and-hyperlinked-apis">5 - Relationships and hyperlinked APIs</a>
|
||||
<a href="../../tutorial/5-relationships-and-hyperlinked-apis/">5 - Relationships and hyperlinked APIs</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/6-viewsets-and-routers">6 - Viewsets and routers</a>
|
||||
<a href="../../tutorial/6-viewsets-and-routers/">6 - Viewsets and routers</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -121,107 +124,107 @@
|
|||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../requests">Requests</a>
|
||||
<a href="../requests/">Requests</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../responses">Responses</a>
|
||||
<a href="../responses/">Responses</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../views">Views</a>
|
||||
<a href="../views/">Views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../generic-views">Generic views</a>
|
||||
<a href="../generic-views/">Generic views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../viewsets">Viewsets</a>
|
||||
<a href="../viewsets/">Viewsets</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../routers">Routers</a>
|
||||
<a href="../routers/">Routers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../parsers">Parsers</a>
|
||||
<a href="../parsers/">Parsers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../renderers">Renderers</a>
|
||||
<a href="../renderers/">Renderers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../serializers">Serializers</a>
|
||||
<a href="../serializers/">Serializers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../fields">Serializer fields</a>
|
||||
<a href="../fields/">Serializer fields</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../relations">Serializer relations</a>
|
||||
<a href="../relations/">Serializer relations</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../validators">Validators</a>
|
||||
<a href="../validators/">Validators</a>
|
||||
</li>
|
||||
|
||||
<li class="active" >
|
||||
<a href=".">Authentication</a>
|
||||
<a href="./">Authentication</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../permissions">Permissions</a>
|
||||
<a href="../permissions/">Permissions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../throttling">Throttling</a>
|
||||
<a href="../throttling/">Throttling</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../filtering">Filtering</a>
|
||||
<a href="../filtering/">Filtering</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../pagination">Pagination</a>
|
||||
<a href="../pagination/">Pagination</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../versioning">Versioning</a>
|
||||
<a href="../versioning/">Versioning</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../content-negotiation">Content negotiation</a>
|
||||
<a href="../content-negotiation/">Content negotiation</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../metadata">Metadata</a>
|
||||
<a href="../metadata/">Metadata</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../format-suffixes">Format suffixes</a>
|
||||
<a href="../format-suffixes/">Format suffixes</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../reverse">Returning URLs</a>
|
||||
<a href="../reverse/">Returning URLs</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../exceptions">Exceptions</a>
|
||||
<a href="../exceptions/">Exceptions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../status-codes">Status codes</a>
|
||||
<a href="../status-codes/">Status codes</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../testing">Testing</a>
|
||||
<a href="../testing/">Testing</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../settings">Settings</a>
|
||||
<a href="../settings/">Settings</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -232,55 +235,55 @@
|
|||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../../topics/documenting-your-api">Documenting your API</a>
|
||||
<a href="../../topics/documenting-your-api/">Documenting your API</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/internationalization">Internationalization</a>
|
||||
<a href="../../topics/internationalization/">Internationalization</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/ajax-csrf-cors">AJAX, CSRF & CORS</a>
|
||||
<a href="../../topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/browser-enhancements">Browser enhancements</a>
|
||||
<a href="../../topics/browser-enhancements/">Browser Enhancements</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/browsable-api">The Browsable API</a>
|
||||
<a href="../../topics/browsable-api/">The Browsable API</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/rest-hypermedia-hateoas">REST, Hypermedia & HATEOAS</a>
|
||||
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/third-party-resources">Third Party Resources</a>
|
||||
<a href="../../topics/third-party-resources/">Third Party Resources</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/contributing">Contributing to REST framework</a>
|
||||
<a href="../../topics/contributing/">Contributing to REST framework</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/project-management">Project management</a>
|
||||
<a href="../../topics/project-management/">Project management</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/3.0-announcement">3.0 Announcement</a>
|
||||
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/3.1-announcement">3.1 Announcement</a>
|
||||
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/kickstarter-announcement">Kickstarter Announcement</a>
|
||||
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/release-notes">Release Notes</a>
|
||||
<a href="../../topics/release-notes/">Release Notes</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -300,27 +303,19 @@
|
|||
<div class="container-fluid">
|
||||
|
||||
<!-- Search Modal -->
|
||||
<div id="searchModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div id="mkdocs_search_modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3 id="myModalLabel">Documentation search</h3>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<!-- Custom google search -->
|
||||
<script>
|
||||
(function() {
|
||||
var cx = '015016005043623903336:rxraeohqk6w';
|
||||
var gcse = document.createElement('script');
|
||||
gcse.type = 'text/javascript';
|
||||
gcse.async = true;
|
||||
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
|
||||
'//www.google.com/cse/cse.js?cx=' + cx;
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(gcse, s);
|
||||
})();
|
||||
</script>
|
||||
<gcse:search></gcse:search>
|
||||
<form role="form">
|
||||
<div class="form-group">
|
||||
<input type="text" name="q" class="form-control" placeholder="Search..." id="mkdocs-search-query">
|
||||
</div>
|
||||
</form>
|
||||
<div id="mkdocs-search-results"></div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
|
|
@ -452,27 +447,30 @@
|
|||
</div>
|
||||
|
||||
<div id="main-content" class="span9">
|
||||
|
||||
|
||||
<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/authentication.py">
|
||||
<span class="label label-info">authentication.py</span>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<h1 id="authentication">Authentication</h1>
|
||||
|
||||
|
||||
<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/authentication.py">
|
||||
<span class="label label-info">authentication.py</span>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<h1 id="authentication">Authentication</h1>
|
||||
<blockquote>
|
||||
<p>Auth needs to be pluggable.</p>
|
||||
<p>— Jacob Kaplan-Moss, <a href="http://jacobian.org/writing/rest-worst-practices/">"REST worst practices"</a></p>
|
||||
</blockquote>
|
||||
<p>Authentication is the mechanism of associating an incoming request with a set of identifying credentials, such as the user the request came from, or the token that it was signed with. The <a href="../permissions">permission</a> and <a href="../throttling">throttling</a> policies can then use those credentials to determine if the request should be permitted.</p>
|
||||
<p>Authentication is the mechanism of associating an incoming request with a set of identifying credentials, such as the user the request came from, or the token that it was signed with. The <a href="../permissions/">permission</a> and <a href="../throttling/">throttling</a> policies can then use those credentials to determine if the request should be permitted.</p>
|
||||
<p>REST framework provides a number of authentication schemes out of the box, and also allows you to implement custom schemes.</p>
|
||||
<p>Authentication is always run at the very start of the view, before the permission and throttling checks occur, and before any other code is allowed to proceed.</p>
|
||||
<p>The <code>request.user</code> property will typically be set to an instance of the <code>contrib.auth</code> package's <code>User</code> class.</p>
|
||||
<p>The <code>request.auth</code> property is used for any additional authentication information, for example, it may be used to represent an authentication token that the request was signed with.</p>
|
||||
<hr />
|
||||
<p><strong>Note:</strong> Don't forget that <strong>authentication by itself won't allow or disallow an incoming request</strong>, it simply identifies the credentials that the request was made with.</p>
|
||||
<p>For information on how to setup the permission polices for your API please see the <a href="../permissions">permissions documentation</a>.</p>
|
||||
<p>For information on how to setup the permission polices for your API please see the <a href="../permissions/">permissions documentation</a>.</p>
|
||||
<hr />
|
||||
<h2 id="how-authentication-is-determined">How authentication is determined</h2>
|
||||
<p>The authentication schemes are always defined as a list of classes. REST framework will attempt to authenticate with each class in the list, and will set <code>request.user</code> and <code>request.auth</code> using the return value of the first class that successfully authenticates.</p>
|
||||
|
|
@ -640,6 +638,8 @@ python manage.py createsuperuser
|
|||
</ul>
|
||||
<p>Unauthenticated responses that are denied permission will result in an <code>HTTP 403 Forbidden</code> response.</p>
|
||||
<p>If you're using an AJAX style API with SessionAuthentication, you'll need to make sure you include a valid CSRF token for any "unsafe" HTTP method calls, such as <code>PUT</code>, <code>PATCH</code>, <code>POST</code> or <code>DELETE</code> requests. See the <a href="https://docs.djangoproject.com/en/dev/ref/csrf/#ajax">Django CSRF documentation</a> for more details.</p>
|
||||
<p><strong>Warning</strong>: Always use Django's standard login view when creating login pages. This will ensure your login views are properly protected.</p>
|
||||
<p>CSRF validation in REST framework works slightly differently to standard Django due to the need to support both session and non-session based authentication to the same views. This means that only authenticated requests require CSRF tokens, and anonymous requests may be sent without CSRF tokens. This behaviour is not suitable for login views, which should always have CSRF validation applied.</p>
|
||||
<h1 id="custom-authentication">Custom authentication</h1>
|
||||
<p>To implement a custom authentication scheme, subclass <code>BaseAuthentication</code> and override the <code>.authenticate(self, request)</code> method. The method should return a two-tuple of <code>(user, auth)</code> if authentication succeeds, or <code>None</code> otherwise.</p>
|
||||
<p>In some circumstances instead of returning <code>None</code>, you may want to raise an <code>AuthenticationFailed</code> exception from the <code>.authenticate()</code> method.</p>
|
||||
|
|
@ -714,6 +714,8 @@ REST_FRAMEWORK = {
|
|||
<h2 id="django-rest-auth">django-rest-auth</h2>
|
||||
<p><a href="https://github.com/Tivix/django-rest-auth">Django-rest-auth</a> library provides a set of REST API endpoints for registration, authentication (including social media authentication), password reset, retrieve and update user details, etc. By having these API endpoints, your client apps such as AngularJS, iOS, Android, and others can communicate to your Django backend site independently via REST APIs for user management.</p>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!--/span-->
|
||||
</div>
|
||||
|
|
@ -737,6 +739,8 @@ REST_FRAMEWORK = {
|
|||
<script src="../../js/jquery-1.8.1-min.js"></script>
|
||||
<script src="../../js/prettify-1.0.js"></script>
|
||||
<script src="../../js/bootstrap-2.1.1-min.js"></script>
|
||||
<script>var base_url = '../..';</script>
|
||||
<script src="../../mkdocs/js/require.js"></script>
|
||||
<script src="../../js/theme.js"></script>
|
||||
|
||||
<script>
|
||||
|
|
|
|||
|
|
@ -62,13 +62,13 @@
|
|||
<div class="navbar-inner">
|
||||
<div class="container-fluid">
|
||||
<a class="repo-link btn btn-primary btn-small" href="https://github.com/tomchristie/django-rest-framework/tree/master">GitHub</a>
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../metadata">
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../metadata/">
|
||||
Next <i class="icon-arrow-right icon-white"></i>
|
||||
</a>
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../versioning">
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../versioning/">
|
||||
<i class="icon-arrow-left icon-white"></i> Previous
|
||||
</a>
|
||||
<a class="repo-link btn btn-inverse btn-small" href="#searchModal" data-toggle="modal"><i class="icon-search icon-white"></i> Search</a>
|
||||
<a id="search_modal_show" class="repo-link btn btn-inverse btn-small" href="#mkdocs_search_modal" data-toggle="modal" data-target="#mkdocs_search_modal"><i class="icon-search icon-white"></i> Search</a>
|
||||
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
|
|
@ -79,38 +79,41 @@
|
|||
|
||||
<!-- Main navigation -->
|
||||
<ul class="nav navbar-nav">
|
||||
<li ><a href="/">Home</a></li>
|
||||
|
||||
<li >
|
||||
<a href="../..">Home</a>
|
||||
</li>
|
||||
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Tutorial <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/quickstart">Quickstart</a>
|
||||
<a href="../../tutorial/quickstart/">Quickstart</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/1-serialization">1 - Serialization</a>
|
||||
<a href="../../tutorial/1-serialization/">1 - Serialization</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/2-requests-and-responses">2 - Requests and responses</a>
|
||||
<a href="../../tutorial/2-requests-and-responses/">2 - Requests and responses</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/3-class-based-views">3 - Class based views</a>
|
||||
<a href="../../tutorial/3-class-based-views/">3 - Class based views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/4-authentication-and-permissions">4 - Authentication and permissions</a>
|
||||
<a href="../../tutorial/4-authentication-and-permissions/">4 - Authentication and permissions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/5-relationships-and-hyperlinked-apis">5 - Relationships and hyperlinked APIs</a>
|
||||
<a href="../../tutorial/5-relationships-and-hyperlinked-apis/">5 - Relationships and hyperlinked APIs</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/6-viewsets-and-routers">6 - Viewsets and routers</a>
|
||||
<a href="../../tutorial/6-viewsets-and-routers/">6 - Viewsets and routers</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -121,107 +124,107 @@
|
|||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../requests">Requests</a>
|
||||
<a href="../requests/">Requests</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../responses">Responses</a>
|
||||
<a href="../responses/">Responses</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../views">Views</a>
|
||||
<a href="../views/">Views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../generic-views">Generic views</a>
|
||||
<a href="../generic-views/">Generic views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../viewsets">Viewsets</a>
|
||||
<a href="../viewsets/">Viewsets</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../routers">Routers</a>
|
||||
<a href="../routers/">Routers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../parsers">Parsers</a>
|
||||
<a href="../parsers/">Parsers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../renderers">Renderers</a>
|
||||
<a href="../renderers/">Renderers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../serializers">Serializers</a>
|
||||
<a href="../serializers/">Serializers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../fields">Serializer fields</a>
|
||||
<a href="../fields/">Serializer fields</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../relations">Serializer relations</a>
|
||||
<a href="../relations/">Serializer relations</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../validators">Validators</a>
|
||||
<a href="../validators/">Validators</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../authentication">Authentication</a>
|
||||
<a href="../authentication/">Authentication</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../permissions">Permissions</a>
|
||||
<a href="../permissions/">Permissions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../throttling">Throttling</a>
|
||||
<a href="../throttling/">Throttling</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../filtering">Filtering</a>
|
||||
<a href="../filtering/">Filtering</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../pagination">Pagination</a>
|
||||
<a href="../pagination/">Pagination</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../versioning">Versioning</a>
|
||||
<a href="../versioning/">Versioning</a>
|
||||
</li>
|
||||
|
||||
<li class="active" >
|
||||
<a href=".">Content negotiation</a>
|
||||
<a href="./">Content negotiation</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../metadata">Metadata</a>
|
||||
<a href="../metadata/">Metadata</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../format-suffixes">Format suffixes</a>
|
||||
<a href="../format-suffixes/">Format suffixes</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../reverse">Returning URLs</a>
|
||||
<a href="../reverse/">Returning URLs</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../exceptions">Exceptions</a>
|
||||
<a href="../exceptions/">Exceptions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../status-codes">Status codes</a>
|
||||
<a href="../status-codes/">Status codes</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../testing">Testing</a>
|
||||
<a href="../testing/">Testing</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../settings">Settings</a>
|
||||
<a href="../settings/">Settings</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -232,55 +235,55 @@
|
|||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../../topics/documenting-your-api">Documenting your API</a>
|
||||
<a href="../../topics/documenting-your-api/">Documenting your API</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/internationalization">Internationalization</a>
|
||||
<a href="../../topics/internationalization/">Internationalization</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/ajax-csrf-cors">AJAX, CSRF & CORS</a>
|
||||
<a href="../../topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/browser-enhancements">Browser enhancements</a>
|
||||
<a href="../../topics/browser-enhancements/">Browser Enhancements</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/browsable-api">The Browsable API</a>
|
||||
<a href="../../topics/browsable-api/">The Browsable API</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/rest-hypermedia-hateoas">REST, Hypermedia & HATEOAS</a>
|
||||
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/third-party-resources">Third Party Resources</a>
|
||||
<a href="../../topics/third-party-resources/">Third Party Resources</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/contributing">Contributing to REST framework</a>
|
||||
<a href="../../topics/contributing/">Contributing to REST framework</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/project-management">Project management</a>
|
||||
<a href="../../topics/project-management/">Project management</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/3.0-announcement">3.0 Announcement</a>
|
||||
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/3.1-announcement">3.1 Announcement</a>
|
||||
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/kickstarter-announcement">Kickstarter Announcement</a>
|
||||
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/release-notes">Release Notes</a>
|
||||
<a href="../../topics/release-notes/">Release Notes</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -300,27 +303,19 @@
|
|||
<div class="container-fluid">
|
||||
|
||||
<!-- Search Modal -->
|
||||
<div id="searchModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div id="mkdocs_search_modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3 id="myModalLabel">Documentation search</h3>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<!-- Custom google search -->
|
||||
<script>
|
||||
(function() {
|
||||
var cx = '015016005043623903336:rxraeohqk6w';
|
||||
var gcse = document.createElement('script');
|
||||
gcse.type = 'text/javascript';
|
||||
gcse.async = true;
|
||||
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
|
||||
'//www.google.com/cse/cse.js?cx=' + cx;
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(gcse, s);
|
||||
})();
|
||||
</script>
|
||||
<gcse:search></gcse:search>
|
||||
<form role="form">
|
||||
<div class="form-group">
|
||||
<input type="text" name="q" class="form-control" placeholder="Search..." id="mkdocs-search-query">
|
||||
</div>
|
||||
</form>
|
||||
<div id="mkdocs-search-results"></div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
|
|
@ -380,15 +375,18 @@
|
|||
</div>
|
||||
|
||||
<div id="main-content" class="span9">
|
||||
|
||||
|
||||
<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/negotiation.py">
|
||||
<span class="label label-info">negotiation.py</span>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<h1 id="content-negotiation">Content negotiation</h1>
|
||||
|
||||
|
||||
<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/negotiation.py">
|
||||
<span class="label label-info">negotiation.py</span>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<h1 id="content-negotiation">Content negotiation</h1>
|
||||
<blockquote>
|
||||
<p>HTTP has provisions for several mechanisms for "content negotiation" - the process of selecting the best representation for a given response when there are multiple representations available.</p>
|
||||
<p>— <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec12.html">RFC 2616</a>, Fielding et al.</p>
|
||||
|
|
@ -461,6 +459,8 @@ class NoNegotiationView(APIView):
|
|||
})
|
||||
</code></pre>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!--/span-->
|
||||
</div>
|
||||
|
|
@ -484,6 +484,8 @@ class NoNegotiationView(APIView):
|
|||
<script src="../../js/jquery-1.8.1-min.js"></script>
|
||||
<script src="../../js/prettify-1.0.js"></script>
|
||||
<script src="../../js/bootstrap-2.1.1-min.js"></script>
|
||||
<script>var base_url = '../..';</script>
|
||||
<script src="../../mkdocs/js/require.js"></script>
|
||||
<script src="../../js/theme.js"></script>
|
||||
|
||||
<script>
|
||||
|
|
|
|||
|
|
@ -62,13 +62,13 @@
|
|||
<div class="navbar-inner">
|
||||
<div class="container-fluid">
|
||||
<a class="repo-link btn btn-primary btn-small" href="https://github.com/tomchristie/django-rest-framework/tree/master">GitHub</a>
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../status-codes">
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../status-codes/">
|
||||
Next <i class="icon-arrow-right icon-white"></i>
|
||||
</a>
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../reverse">
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../reverse/">
|
||||
<i class="icon-arrow-left icon-white"></i> Previous
|
||||
</a>
|
||||
<a class="repo-link btn btn-inverse btn-small" href="#searchModal" data-toggle="modal"><i class="icon-search icon-white"></i> Search</a>
|
||||
<a id="search_modal_show" class="repo-link btn btn-inverse btn-small" href="#mkdocs_search_modal" data-toggle="modal" data-target="#mkdocs_search_modal"><i class="icon-search icon-white"></i> Search</a>
|
||||
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
|
|
@ -79,38 +79,41 @@
|
|||
|
||||
<!-- Main navigation -->
|
||||
<ul class="nav navbar-nav">
|
||||
<li ><a href="/">Home</a></li>
|
||||
|
||||
<li >
|
||||
<a href="../..">Home</a>
|
||||
</li>
|
||||
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Tutorial <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/quickstart">Quickstart</a>
|
||||
<a href="../../tutorial/quickstart/">Quickstart</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/1-serialization">1 - Serialization</a>
|
||||
<a href="../../tutorial/1-serialization/">1 - Serialization</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/2-requests-and-responses">2 - Requests and responses</a>
|
||||
<a href="../../tutorial/2-requests-and-responses/">2 - Requests and responses</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/3-class-based-views">3 - Class based views</a>
|
||||
<a href="../../tutorial/3-class-based-views/">3 - Class based views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/4-authentication-and-permissions">4 - Authentication and permissions</a>
|
||||
<a href="../../tutorial/4-authentication-and-permissions/">4 - Authentication and permissions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/5-relationships-and-hyperlinked-apis">5 - Relationships and hyperlinked APIs</a>
|
||||
<a href="../../tutorial/5-relationships-and-hyperlinked-apis/">5 - Relationships and hyperlinked APIs</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/6-viewsets-and-routers">6 - Viewsets and routers</a>
|
||||
<a href="../../tutorial/6-viewsets-and-routers/">6 - Viewsets and routers</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -121,107 +124,107 @@
|
|||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../requests">Requests</a>
|
||||
<a href="../requests/">Requests</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../responses">Responses</a>
|
||||
<a href="../responses/">Responses</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../views">Views</a>
|
||||
<a href="../views/">Views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../generic-views">Generic views</a>
|
||||
<a href="../generic-views/">Generic views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../viewsets">Viewsets</a>
|
||||
<a href="../viewsets/">Viewsets</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../routers">Routers</a>
|
||||
<a href="../routers/">Routers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../parsers">Parsers</a>
|
||||
<a href="../parsers/">Parsers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../renderers">Renderers</a>
|
||||
<a href="../renderers/">Renderers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../serializers">Serializers</a>
|
||||
<a href="../serializers/">Serializers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../fields">Serializer fields</a>
|
||||
<a href="../fields/">Serializer fields</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../relations">Serializer relations</a>
|
||||
<a href="../relations/">Serializer relations</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../validators">Validators</a>
|
||||
<a href="../validators/">Validators</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../authentication">Authentication</a>
|
||||
<a href="../authentication/">Authentication</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../permissions">Permissions</a>
|
||||
<a href="../permissions/">Permissions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../throttling">Throttling</a>
|
||||
<a href="../throttling/">Throttling</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../filtering">Filtering</a>
|
||||
<a href="../filtering/">Filtering</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../pagination">Pagination</a>
|
||||
<a href="../pagination/">Pagination</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../versioning">Versioning</a>
|
||||
<a href="../versioning/">Versioning</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../content-negotiation">Content negotiation</a>
|
||||
<a href="../content-negotiation/">Content negotiation</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../metadata">Metadata</a>
|
||||
<a href="../metadata/">Metadata</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../format-suffixes">Format suffixes</a>
|
||||
<a href="../format-suffixes/">Format suffixes</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../reverse">Returning URLs</a>
|
||||
<a href="../reverse/">Returning URLs</a>
|
||||
</li>
|
||||
|
||||
<li class="active" >
|
||||
<a href=".">Exceptions</a>
|
||||
<a href="./">Exceptions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../status-codes">Status codes</a>
|
||||
<a href="../status-codes/">Status codes</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../testing">Testing</a>
|
||||
<a href="../testing/">Testing</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../settings">Settings</a>
|
||||
<a href="../settings/">Settings</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -232,55 +235,55 @@
|
|||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../../topics/documenting-your-api">Documenting your API</a>
|
||||
<a href="../../topics/documenting-your-api/">Documenting your API</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/internationalization">Internationalization</a>
|
||||
<a href="../../topics/internationalization/">Internationalization</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/ajax-csrf-cors">AJAX, CSRF & CORS</a>
|
||||
<a href="../../topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/browser-enhancements">Browser enhancements</a>
|
||||
<a href="../../topics/browser-enhancements/">Browser Enhancements</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/browsable-api">The Browsable API</a>
|
||||
<a href="../../topics/browsable-api/">The Browsable API</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/rest-hypermedia-hateoas">REST, Hypermedia & HATEOAS</a>
|
||||
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/third-party-resources">Third Party Resources</a>
|
||||
<a href="../../topics/third-party-resources/">Third Party Resources</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/contributing">Contributing to REST framework</a>
|
||||
<a href="../../topics/contributing/">Contributing to REST framework</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/project-management">Project management</a>
|
||||
<a href="../../topics/project-management/">Project management</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/3.0-announcement">3.0 Announcement</a>
|
||||
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/3.1-announcement">3.1 Announcement</a>
|
||||
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/kickstarter-announcement">Kickstarter Announcement</a>
|
||||
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/release-notes">Release Notes</a>
|
||||
<a href="../../topics/release-notes/">Release Notes</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -300,27 +303,19 @@
|
|||
<div class="container-fluid">
|
||||
|
||||
<!-- Search Modal -->
|
||||
<div id="searchModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div id="mkdocs_search_modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3 id="myModalLabel">Documentation search</h3>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<!-- Custom google search -->
|
||||
<script>
|
||||
(function() {
|
||||
var cx = '015016005043623903336:rxraeohqk6w';
|
||||
var gcse = document.createElement('script');
|
||||
gcse.type = 'text/javascript';
|
||||
gcse.async = true;
|
||||
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
|
||||
'//www.google.com/cse/cse.js?cx=' + cx;
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(gcse, s);
|
||||
})();
|
||||
</script>
|
||||
<gcse:search></gcse:search>
|
||||
<form role="form">
|
||||
<div class="form-group">
|
||||
<input type="text" name="q" class="form-control" placeholder="Search..." id="mkdocs-search-query">
|
||||
</div>
|
||||
</form>
|
||||
<div id="mkdocs-search-results"></div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
|
|
@ -420,15 +415,18 @@
|
|||
</div>
|
||||
|
||||
<div id="main-content" class="span9">
|
||||
|
||||
|
||||
<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/exceptions.py">
|
||||
<span class="label label-info">exceptions.py</span>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<h1 id="exceptions">Exceptions</h1>
|
||||
|
||||
|
||||
<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/exceptions.py">
|
||||
<span class="label label-info">exceptions.py</span>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<h1 id="exceptions">Exceptions</h1>
|
||||
<blockquote>
|
||||
<p>Exceptions… allow error handling to be organized cleanly in a central or high-level place within the program structure.</p>
|
||||
<p>— Doug Hellmann, <a href="http://www.doughellmann.com/articles/how-tos/python-exception-handling/index.html">Python Exception Handling Techniques</a></p>
|
||||
|
|
@ -518,11 +516,11 @@ class ServiceUnavailable(APIException):
|
|||
<h2 id="authenticationfailed">AuthenticationFailed</h2>
|
||||
<p><strong>Signature:</strong> <code>AuthenticationFailed(detail=None)</code></p>
|
||||
<p>Raised when an incoming request includes incorrect authentication.</p>
|
||||
<p>By default this exception results in a response with the HTTP status code "401 Unauthenticated", but it may also result in a "403 Forbidden" response, depending on the authentication scheme in use. See the <a href="../authentication">authentication documentation</a> for more details.</p>
|
||||
<p>By default this exception results in a response with the HTTP status code "401 Unauthenticated", but it may also result in a "403 Forbidden" response, depending on the authentication scheme in use. See the <a href="../authentication/">authentication documentation</a> for more details.</p>
|
||||
<h2 id="notauthenticated">NotAuthenticated</h2>
|
||||
<p><strong>Signature:</strong> <code>NotAuthenticated(detail=None)</code></p>
|
||||
<p>Raised when an unauthenticated request fails the permission checks.</p>
|
||||
<p>By default this exception results in a response with the HTTP status code "401 Unauthenticated", but it may also result in a "403 Forbidden" response, depending on the authentication scheme in use. See the <a href="../authentication">authentication documentation</a> for more details.</p>
|
||||
<p>By default this exception results in a response with the HTTP status code "401 Unauthenticated", but it may also result in a "403 Forbidden" response, depending on the authentication scheme in use. See the <a href="../authentication/">authentication documentation</a> for more details.</p>
|
||||
<h2 id="permissiondenied">PermissionDenied</h2>
|
||||
<p><strong>Signature:</strong> <code>PermissionDenied(detail=None)</code></p>
|
||||
<p>Raised when an authenticated request fails the permission checks.</p>
|
||||
|
|
@ -561,6 +559,8 @@ class ServiceUnavailable(APIException):
|
|||
<p>The generic views use the <code>raise_exception=True</code> flag, which means that you can override the style of validation error responses globally in your API. To do so, use a custom exception handler, as described above.</p>
|
||||
<p>By default this exception results in a response with the HTTP status code "400 Bad Request".</p>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!--/span-->
|
||||
</div>
|
||||
|
|
@ -584,6 +584,8 @@ class ServiceUnavailable(APIException):
|
|||
<script src="../../js/jquery-1.8.1-min.js"></script>
|
||||
<script src="../../js/prettify-1.0.js"></script>
|
||||
<script src="../../js/bootstrap-2.1.1-min.js"></script>
|
||||
<script>var base_url = '../..';</script>
|
||||
<script src="../../mkdocs/js/require.js"></script>
|
||||
<script src="../../js/theme.js"></script>
|
||||
|
||||
<script>
|
||||
|
|
|
|||
|
|
@ -62,13 +62,13 @@
|
|||
<div class="navbar-inner">
|
||||
<div class="container-fluid">
|
||||
<a class="repo-link btn btn-primary btn-small" href="https://github.com/tomchristie/django-rest-framework/tree/master">GitHub</a>
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../relations">
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../relations/">
|
||||
Next <i class="icon-arrow-right icon-white"></i>
|
||||
</a>
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../serializers">
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../serializers/">
|
||||
<i class="icon-arrow-left icon-white"></i> Previous
|
||||
</a>
|
||||
<a class="repo-link btn btn-inverse btn-small" href="#searchModal" data-toggle="modal"><i class="icon-search icon-white"></i> Search</a>
|
||||
<a id="search_modal_show" class="repo-link btn btn-inverse btn-small" href="#mkdocs_search_modal" data-toggle="modal" data-target="#mkdocs_search_modal"><i class="icon-search icon-white"></i> Search</a>
|
||||
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
|
|
@ -79,38 +79,41 @@
|
|||
|
||||
<!-- Main navigation -->
|
||||
<ul class="nav navbar-nav">
|
||||
<li ><a href="/">Home</a></li>
|
||||
|
||||
<li >
|
||||
<a href="../..">Home</a>
|
||||
</li>
|
||||
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Tutorial <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/quickstart">Quickstart</a>
|
||||
<a href="../../tutorial/quickstart/">Quickstart</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/1-serialization">1 - Serialization</a>
|
||||
<a href="../../tutorial/1-serialization/">1 - Serialization</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/2-requests-and-responses">2 - Requests and responses</a>
|
||||
<a href="../../tutorial/2-requests-and-responses/">2 - Requests and responses</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/3-class-based-views">3 - Class based views</a>
|
||||
<a href="../../tutorial/3-class-based-views/">3 - Class based views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/4-authentication-and-permissions">4 - Authentication and permissions</a>
|
||||
<a href="../../tutorial/4-authentication-and-permissions/">4 - Authentication and permissions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/5-relationships-and-hyperlinked-apis">5 - Relationships and hyperlinked APIs</a>
|
||||
<a href="../../tutorial/5-relationships-and-hyperlinked-apis/">5 - Relationships and hyperlinked APIs</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/6-viewsets-and-routers">6 - Viewsets and routers</a>
|
||||
<a href="../../tutorial/6-viewsets-and-routers/">6 - Viewsets and routers</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -121,107 +124,107 @@
|
|||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../requests">Requests</a>
|
||||
<a href="../requests/">Requests</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../responses">Responses</a>
|
||||
<a href="../responses/">Responses</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../views">Views</a>
|
||||
<a href="../views/">Views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../generic-views">Generic views</a>
|
||||
<a href="../generic-views/">Generic views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../viewsets">Viewsets</a>
|
||||
<a href="../viewsets/">Viewsets</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../routers">Routers</a>
|
||||
<a href="../routers/">Routers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../parsers">Parsers</a>
|
||||
<a href="../parsers/">Parsers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../renderers">Renderers</a>
|
||||
<a href="../renderers/">Renderers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../serializers">Serializers</a>
|
||||
<a href="../serializers/">Serializers</a>
|
||||
</li>
|
||||
|
||||
<li class="active" >
|
||||
<a href=".">Serializer fields</a>
|
||||
<a href="./">Serializer fields</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../relations">Serializer relations</a>
|
||||
<a href="../relations/">Serializer relations</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../validators">Validators</a>
|
||||
<a href="../validators/">Validators</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../authentication">Authentication</a>
|
||||
<a href="../authentication/">Authentication</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../permissions">Permissions</a>
|
||||
<a href="../permissions/">Permissions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../throttling">Throttling</a>
|
||||
<a href="../throttling/">Throttling</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../filtering">Filtering</a>
|
||||
<a href="../filtering/">Filtering</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../pagination">Pagination</a>
|
||||
<a href="../pagination/">Pagination</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../versioning">Versioning</a>
|
||||
<a href="../versioning/">Versioning</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../content-negotiation">Content negotiation</a>
|
||||
<a href="../content-negotiation/">Content negotiation</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../metadata">Metadata</a>
|
||||
<a href="../metadata/">Metadata</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../format-suffixes">Format suffixes</a>
|
||||
<a href="../format-suffixes/">Format suffixes</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../reverse">Returning URLs</a>
|
||||
<a href="../reverse/">Returning URLs</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../exceptions">Exceptions</a>
|
||||
<a href="../exceptions/">Exceptions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../status-codes">Status codes</a>
|
||||
<a href="../status-codes/">Status codes</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../testing">Testing</a>
|
||||
<a href="../testing/">Testing</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../settings">Settings</a>
|
||||
<a href="../settings/">Settings</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -232,55 +235,55 @@
|
|||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../../topics/documenting-your-api">Documenting your API</a>
|
||||
<a href="../../topics/documenting-your-api/">Documenting your API</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/internationalization">Internationalization</a>
|
||||
<a href="../../topics/internationalization/">Internationalization</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/ajax-csrf-cors">AJAX, CSRF & CORS</a>
|
||||
<a href="../../topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/browser-enhancements">Browser enhancements</a>
|
||||
<a href="../../topics/browser-enhancements/">Browser Enhancements</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/browsable-api">The Browsable API</a>
|
||||
<a href="../../topics/browsable-api/">The Browsable API</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/rest-hypermedia-hateoas">REST, Hypermedia & HATEOAS</a>
|
||||
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/third-party-resources">Third Party Resources</a>
|
||||
<a href="../../topics/third-party-resources/">Third Party Resources</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/contributing">Contributing to REST framework</a>
|
||||
<a href="../../topics/contributing/">Contributing to REST framework</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/project-management">Project management</a>
|
||||
<a href="../../topics/project-management/">Project management</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/3.0-announcement">3.0 Announcement</a>
|
||||
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/3.1-announcement">3.1 Announcement</a>
|
||||
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/kickstarter-announcement">Kickstarter Announcement</a>
|
||||
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/release-notes">Release Notes</a>
|
||||
<a href="../../topics/release-notes/">Release Notes</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -300,27 +303,19 @@
|
|||
<div class="container-fluid">
|
||||
|
||||
<!-- Search Modal -->
|
||||
<div id="searchModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div id="mkdocs_search_modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3 id="myModalLabel">Documentation search</h3>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<!-- Custom google search -->
|
||||
<script>
|
||||
(function() {
|
||||
var cx = '015016005043623903336:rxraeohqk6w';
|
||||
var gcse = document.createElement('script');
|
||||
gcse.type = 'text/javascript';
|
||||
gcse.async = true;
|
||||
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
|
||||
'//www.google.com/cse/cse.js?cx=' + cx;
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(gcse, s);
|
||||
})();
|
||||
</script>
|
||||
<gcse:search></gcse:search>
|
||||
<form role="form">
|
||||
<div class="form-group">
|
||||
<input type="text" name="q" class="form-control" placeholder="Search..." id="mkdocs-search-query">
|
||||
</div>
|
||||
</form>
|
||||
<div id="mkdocs-search-results"></div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
|
|
@ -401,6 +396,10 @@
|
|||
<a href="#uuidfield">UUIDField</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="#ipaddressfield">IPAddressField</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -441,6 +440,10 @@
|
|||
<a href="#timefield">TimeField</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="#durationfield">DurationField</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -568,15 +571,18 @@
|
|||
</div>
|
||||
|
||||
<div id="main-content" class="span9">
|
||||
|
||||
|
||||
<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/fields.py">
|
||||
<span class="label label-info">fields.py</span>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<h1 id="serializer-fields">Serializer fields</h1>
|
||||
|
||||
|
||||
<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/fields.py">
|
||||
<span class="label label-info">fields.py</span>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<h1 id="serializer-fields">Serializer fields</h1>
|
||||
<blockquote>
|
||||
<p>Each field in a Form class is responsible not only for validating data, but also for "cleaning" it — normalizing it to a consistent format.</p>
|
||||
<p>— <a href="https://docs.djangoproject.com/en/dev/ref/forms/api/#django.forms.Form.cleaned_data">Django documentation</a></p>
|
||||
|
|
@ -680,6 +686,25 @@ color_channel = serializers.ChoiceField(
|
|||
<p>A field that ensures the input is a valid UUID string. The <code>to_internal_value</code> method will return a <code>uuid.UUID</code> instance. On output the field will return a string in the canonical hyphenated format, for example:</p>
|
||||
<pre><code>"de305d54-75b4-431b-adb2-eb6b9e546013"
|
||||
</code></pre>
|
||||
<p><strong>Signature:</strong> <code>UUIDField(format='hex_verbose')</code></p>
|
||||
<ul>
|
||||
<li><code>format</code>: Determines the representation format of the uuid value<ul>
|
||||
<li><code>'hex_verbose'</code> - The cannoncical hex representation, including hyphens: <code>"5ce0e9a5-5ffa-654b-cee0-1238041fb31a"</code></li>
|
||||
<li><code>'hex'</code> - The compact hex representation of the UUID, not including hyphens: <code>"5ce0e9a55ffa654bcee01238041fb31a"</code></li>
|
||||
<li><code>'int'</code> - A 128 bit integer representation of the UUID: <code>"123456789012312313134124512351145145114"</code></li>
|
||||
<li><code>'urn'</code> - RFC 4122 URN representation of the UUID: <code>"urn:uuid:5ce0e9a5-5ffa-654b-cee0-1238041fb31a"</code>
|
||||
Changing the <code>format</code> parameters only affects representation values. All formats are accepted by <code>to_internal_value</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<h2 id="ipaddressfield">IPAddressField</h2>
|
||||
<p>A field that ensures the input is a valid IPv4 or IPv6 string.</p>
|
||||
<p>Corresponds to <code>django.forms.fields.IPAddressField</code> and <code>django.forms.fields.GenericIPAddressField</code>.</p>
|
||||
<p><strong>Signature</strong>: <code>IPAddressField(protocol='both', unpack_ipv4=False, **options)</code></p>
|
||||
<ul>
|
||||
<li><code>protocol</code> Limits valid inputs to the specified protocol. Accepted values are 'both' (default), 'IPv4' or 'IPv6'. Matching is case insensitive.</li>
|
||||
<li><code>unpack_ipv4</code> Unpacks IPv4 mapped addresses like ::ffff:192.0.2.1. If this option is enabled that address would be unpacked to 192.0.2.1. Default is disabled. Can only be used when protocol is set to 'both'.</li>
|
||||
</ul>
|
||||
<hr />
|
||||
<h1 id="numeric-fields">Numeric fields</h1>
|
||||
<h2 id="integerfield">IntegerField</h2>
|
||||
|
|
@ -761,6 +786,13 @@ color_channel = serializers.ChoiceField(
|
|||
</ul>
|
||||
<h4 id="timefield-format-strings"><code>TimeField</code> format strings</h4>
|
||||
<p>Format strings may either be <a href="http://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior">Python strftime formats</a> which explicitly specify the format, or the special string <code>'iso-8601'</code>, which indicates that <a href="http://www.w3.org/TR/NOTE-datetime">ISO 8601</a> style times should be used. (eg <code>'12:34:56.000000'</code>)</p>
|
||||
<h2 id="durationfield">DurationField</h2>
|
||||
<p>A Duration representation.
|
||||
Corresponds to <code>django.db.models.fields.DurationField</code></p>
|
||||
<p>The <code>validated_data</code> for these fields will contain a <code>datetime.timedelta</code> instance.
|
||||
The representation is a string following this format <code>'[DD] [HH:[MM:]]ss[.uuuuuu]'</code>.</p>
|
||||
<p><strong>Note:</strong> This field is only available with Django versions >= 1.8.</p>
|
||||
<p><strong>Signature:</strong> <code>DurationField()</code></p>
|
||||
<hr />
|
||||
<h1 id="choice-selection-fields">Choice selection fields</h1>
|
||||
<h2 id="choicefield">ChoiceField</h2>
|
||||
|
|
@ -854,7 +886,7 @@ Django's regular <a href="https://docs.djangoproject.com/en/dev/ref/settings/#st
|
|||
<pre><code>modified = serializers.HiddenField(default=timezone.now)
|
||||
</code></pre>
|
||||
<p>The <code>HiddenField</code> class is usually only needed if you have some validation that needs to run based on some pre-provided field values, but you do not want to expose all of those fields to the end user.</p>
|
||||
<p>For further examples on <code>HiddenField</code> see the <a href="../validators">validators</a> documentation.</p>
|
||||
<p>For further examples on <code>HiddenField</code> see the <a href="../validators/">validators</a> documentation.</p>
|
||||
<h2 id="modelfield">ModelField</h2>
|
||||
<p>A generic field that can be tied to any arbitrary model field. The <code>ModelField</code> class delegates the task of serialization/deserialization to its associated model field. This field can be used to create serializer fields for custom model fields, without having to create a new custom serializer field.</p>
|
||||
<p>This field is used by <code>ModelSerializer</code> to correspond to custom model field classes.</p>
|
||||
|
|
@ -979,6 +1011,8 @@ def to_internal_value(self, data):
|
|||
<h2 id="django-rest-framework-hstore">django-rest-framework-hstore</h2>
|
||||
<p>The <a href="https://github.com/djangonauts/django-rest-framework-hstore">django-rest-framework-hstore</a> package provides an <code>HStoreField</code> to support <a href="https://github.com/djangonauts/django-hstore">django-hstore</a> <code>DictionaryField</code> model field.</p>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!--/span-->
|
||||
</div>
|
||||
|
|
@ -1002,6 +1036,8 @@ def to_internal_value(self, data):
|
|||
<script src="../../js/jquery-1.8.1-min.js"></script>
|
||||
<script src="../../js/prettify-1.0.js"></script>
|
||||
<script src="../../js/bootstrap-2.1.1-min.js"></script>
|
||||
<script>var base_url = '../..';</script>
|
||||
<script src="../../mkdocs/js/require.js"></script>
|
||||
<script src="../../js/theme.js"></script>
|
||||
|
||||
<script>
|
||||
|
|
|
|||
|
|
@ -62,13 +62,13 @@
|
|||
<div class="navbar-inner">
|
||||
<div class="container-fluid">
|
||||
<a class="repo-link btn btn-primary btn-small" href="https://github.com/tomchristie/django-rest-framework/tree/master">GitHub</a>
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../pagination">
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../pagination/">
|
||||
Next <i class="icon-arrow-right icon-white"></i>
|
||||
</a>
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../throttling">
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../throttling/">
|
||||
<i class="icon-arrow-left icon-white"></i> Previous
|
||||
</a>
|
||||
<a class="repo-link btn btn-inverse btn-small" href="#searchModal" data-toggle="modal"><i class="icon-search icon-white"></i> Search</a>
|
||||
<a id="search_modal_show" class="repo-link btn btn-inverse btn-small" href="#mkdocs_search_modal" data-toggle="modal" data-target="#mkdocs_search_modal"><i class="icon-search icon-white"></i> Search</a>
|
||||
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
|
|
@ -79,38 +79,41 @@
|
|||
|
||||
<!-- Main navigation -->
|
||||
<ul class="nav navbar-nav">
|
||||
<li ><a href="/">Home</a></li>
|
||||
|
||||
<li >
|
||||
<a href="../..">Home</a>
|
||||
</li>
|
||||
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Tutorial <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/quickstart">Quickstart</a>
|
||||
<a href="../../tutorial/quickstart/">Quickstart</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/1-serialization">1 - Serialization</a>
|
||||
<a href="../../tutorial/1-serialization/">1 - Serialization</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/2-requests-and-responses">2 - Requests and responses</a>
|
||||
<a href="../../tutorial/2-requests-and-responses/">2 - Requests and responses</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/3-class-based-views">3 - Class based views</a>
|
||||
<a href="../../tutorial/3-class-based-views/">3 - Class based views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/4-authentication-and-permissions">4 - Authentication and permissions</a>
|
||||
<a href="../../tutorial/4-authentication-and-permissions/">4 - Authentication and permissions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/5-relationships-and-hyperlinked-apis">5 - Relationships and hyperlinked APIs</a>
|
||||
<a href="../../tutorial/5-relationships-and-hyperlinked-apis/">5 - Relationships and hyperlinked APIs</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/6-viewsets-and-routers">6 - Viewsets and routers</a>
|
||||
<a href="../../tutorial/6-viewsets-and-routers/">6 - Viewsets and routers</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -121,107 +124,107 @@
|
|||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../requests">Requests</a>
|
||||
<a href="../requests/">Requests</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../responses">Responses</a>
|
||||
<a href="../responses/">Responses</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../views">Views</a>
|
||||
<a href="../views/">Views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../generic-views">Generic views</a>
|
||||
<a href="../generic-views/">Generic views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../viewsets">Viewsets</a>
|
||||
<a href="../viewsets/">Viewsets</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../routers">Routers</a>
|
||||
<a href="../routers/">Routers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../parsers">Parsers</a>
|
||||
<a href="../parsers/">Parsers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../renderers">Renderers</a>
|
||||
<a href="../renderers/">Renderers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../serializers">Serializers</a>
|
||||
<a href="../serializers/">Serializers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../fields">Serializer fields</a>
|
||||
<a href="../fields/">Serializer fields</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../relations">Serializer relations</a>
|
||||
<a href="../relations/">Serializer relations</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../validators">Validators</a>
|
||||
<a href="../validators/">Validators</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../authentication">Authentication</a>
|
||||
<a href="../authentication/">Authentication</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../permissions">Permissions</a>
|
||||
<a href="../permissions/">Permissions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../throttling">Throttling</a>
|
||||
<a href="../throttling/">Throttling</a>
|
||||
</li>
|
||||
|
||||
<li class="active" >
|
||||
<a href=".">Filtering</a>
|
||||
<a href="./">Filtering</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../pagination">Pagination</a>
|
||||
<a href="../pagination/">Pagination</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../versioning">Versioning</a>
|
||||
<a href="../versioning/">Versioning</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../content-negotiation">Content negotiation</a>
|
||||
<a href="../content-negotiation/">Content negotiation</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../metadata">Metadata</a>
|
||||
<a href="../metadata/">Metadata</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../format-suffixes">Format suffixes</a>
|
||||
<a href="../format-suffixes/">Format suffixes</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../reverse">Returning URLs</a>
|
||||
<a href="../reverse/">Returning URLs</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../exceptions">Exceptions</a>
|
||||
<a href="../exceptions/">Exceptions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../status-codes">Status codes</a>
|
||||
<a href="../status-codes/">Status codes</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../testing">Testing</a>
|
||||
<a href="../testing/">Testing</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../settings">Settings</a>
|
||||
<a href="../settings/">Settings</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -232,55 +235,55 @@
|
|||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../../topics/documenting-your-api">Documenting your API</a>
|
||||
<a href="../../topics/documenting-your-api/">Documenting your API</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/internationalization">Internationalization</a>
|
||||
<a href="../../topics/internationalization/">Internationalization</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/ajax-csrf-cors">AJAX, CSRF & CORS</a>
|
||||
<a href="../../topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/browser-enhancements">Browser enhancements</a>
|
||||
<a href="../../topics/browser-enhancements/">Browser Enhancements</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/browsable-api">The Browsable API</a>
|
||||
<a href="../../topics/browsable-api/">The Browsable API</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/rest-hypermedia-hateoas">REST, Hypermedia & HATEOAS</a>
|
||||
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/third-party-resources">Third Party Resources</a>
|
||||
<a href="../../topics/third-party-resources/">Third Party Resources</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/contributing">Contributing to REST framework</a>
|
||||
<a href="../../topics/contributing/">Contributing to REST framework</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/project-management">Project management</a>
|
||||
<a href="../../topics/project-management/">Project management</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/3.0-announcement">3.0 Announcement</a>
|
||||
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/3.1-announcement">3.1 Announcement</a>
|
||||
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/kickstarter-announcement">Kickstarter Announcement</a>
|
||||
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/release-notes">Release Notes</a>
|
||||
<a href="../../topics/release-notes/">Release Notes</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -300,27 +303,19 @@
|
|||
<div class="container-fluid">
|
||||
|
||||
<!-- Search Modal -->
|
||||
<div id="searchModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div id="mkdocs_search_modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3 id="myModalLabel">Documentation search</h3>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<!-- Custom google search -->
|
||||
<script>
|
||||
(function() {
|
||||
var cx = '015016005043623903336:rxraeohqk6w';
|
||||
var gcse = document.createElement('script');
|
||||
gcse.type = 'text/javascript';
|
||||
gcse.async = true;
|
||||
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
|
||||
'//www.google.com/cse/cse.js?cx=' + cx;
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(gcse, s);
|
||||
})();
|
||||
</script>
|
||||
<gcse:search></gcse:search>
|
||||
<form role="form">
|
||||
<div class="form-group">
|
||||
<input type="text" name="q" class="form-control" placeholder="Search..." id="mkdocs-search-query">
|
||||
</div>
|
||||
</form>
|
||||
<div id="mkdocs-search-results"></div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
|
|
@ -444,15 +439,18 @@
|
|||
</div>
|
||||
|
||||
<div id="main-content" class="span9">
|
||||
|
||||
|
||||
<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/filters.py">
|
||||
<span class="label label-info">filters.py</span>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<h1 id="filtering">Filtering</h1>
|
||||
|
||||
|
||||
<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/filters.py">
|
||||
<span class="label label-info">filters.py</span>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<h1 id="filtering">Filtering</h1>
|
||||
<blockquote>
|
||||
<p>The root QuerySet provided by the Manager describes all objects in the database table. Usually, though, you'll need to select only a subset of the complete set of objects.</p>
|
||||
<p>— <a href="https://docs.djangoproject.com/en/dev/topics/db/queries/#retrieving-specific-objects-with-filters">Django documentation</a></p>
|
||||
|
|
@ -758,6 +756,8 @@ class ProductFilter(django_filters.FilterSet):
|
|||
<h2 id="django-rest-framework-full-word-search-filter">Django REST framework full word search filter</h2>
|
||||
<p>The <a href="https://github.com/trollknurr/django-rest-framework-word-search-filter">djangorestframework-word-filter</a> developed as alternative to <code>filters.SearchFilter</code> which will search full word in text, or exact match.</p>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!--/span-->
|
||||
</div>
|
||||
|
|
@ -781,6 +781,8 @@ class ProductFilter(django_filters.FilterSet):
|
|||
<script src="../../js/jquery-1.8.1-min.js"></script>
|
||||
<script src="../../js/prettify-1.0.js"></script>
|
||||
<script src="../../js/bootstrap-2.1.1-min.js"></script>
|
||||
<script>var base_url = '../..';</script>
|
||||
<script src="../../mkdocs/js/require.js"></script>
|
||||
<script src="../../js/theme.js"></script>
|
||||
|
||||
<script>
|
||||
|
|
|
|||
|
|
@ -62,13 +62,13 @@
|
|||
<div class="navbar-inner">
|
||||
<div class="container-fluid">
|
||||
<a class="repo-link btn btn-primary btn-small" href="https://github.com/tomchristie/django-rest-framework/tree/master">GitHub</a>
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../reverse">
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../reverse/">
|
||||
Next <i class="icon-arrow-right icon-white"></i>
|
||||
</a>
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../metadata">
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../metadata/">
|
||||
<i class="icon-arrow-left icon-white"></i> Previous
|
||||
</a>
|
||||
<a class="repo-link btn btn-inverse btn-small" href="#searchModal" data-toggle="modal"><i class="icon-search icon-white"></i> Search</a>
|
||||
<a id="search_modal_show" class="repo-link btn btn-inverse btn-small" href="#mkdocs_search_modal" data-toggle="modal" data-target="#mkdocs_search_modal"><i class="icon-search icon-white"></i> Search</a>
|
||||
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
|
|
@ -79,38 +79,41 @@
|
|||
|
||||
<!-- Main navigation -->
|
||||
<ul class="nav navbar-nav">
|
||||
<li ><a href="/">Home</a></li>
|
||||
|
||||
<li >
|
||||
<a href="../..">Home</a>
|
||||
</li>
|
||||
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Tutorial <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/quickstart">Quickstart</a>
|
||||
<a href="../../tutorial/quickstart/">Quickstart</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/1-serialization">1 - Serialization</a>
|
||||
<a href="../../tutorial/1-serialization/">1 - Serialization</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/2-requests-and-responses">2 - Requests and responses</a>
|
||||
<a href="../../tutorial/2-requests-and-responses/">2 - Requests and responses</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/3-class-based-views">3 - Class based views</a>
|
||||
<a href="../../tutorial/3-class-based-views/">3 - Class based views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/4-authentication-and-permissions">4 - Authentication and permissions</a>
|
||||
<a href="../../tutorial/4-authentication-and-permissions/">4 - Authentication and permissions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/5-relationships-and-hyperlinked-apis">5 - Relationships and hyperlinked APIs</a>
|
||||
<a href="../../tutorial/5-relationships-and-hyperlinked-apis/">5 - Relationships and hyperlinked APIs</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/6-viewsets-and-routers">6 - Viewsets and routers</a>
|
||||
<a href="../../tutorial/6-viewsets-and-routers/">6 - Viewsets and routers</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -121,107 +124,107 @@
|
|||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../requests">Requests</a>
|
||||
<a href="../requests/">Requests</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../responses">Responses</a>
|
||||
<a href="../responses/">Responses</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../views">Views</a>
|
||||
<a href="../views/">Views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../generic-views">Generic views</a>
|
||||
<a href="../generic-views/">Generic views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../viewsets">Viewsets</a>
|
||||
<a href="../viewsets/">Viewsets</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../routers">Routers</a>
|
||||
<a href="../routers/">Routers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../parsers">Parsers</a>
|
||||
<a href="../parsers/">Parsers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../renderers">Renderers</a>
|
||||
<a href="../renderers/">Renderers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../serializers">Serializers</a>
|
||||
<a href="../serializers/">Serializers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../fields">Serializer fields</a>
|
||||
<a href="../fields/">Serializer fields</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../relations">Serializer relations</a>
|
||||
<a href="../relations/">Serializer relations</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../validators">Validators</a>
|
||||
<a href="../validators/">Validators</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../authentication">Authentication</a>
|
||||
<a href="../authentication/">Authentication</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../permissions">Permissions</a>
|
||||
<a href="../permissions/">Permissions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../throttling">Throttling</a>
|
||||
<a href="../throttling/">Throttling</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../filtering">Filtering</a>
|
||||
<a href="../filtering/">Filtering</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../pagination">Pagination</a>
|
||||
<a href="../pagination/">Pagination</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../versioning">Versioning</a>
|
||||
<a href="../versioning/">Versioning</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../content-negotiation">Content negotiation</a>
|
||||
<a href="../content-negotiation/">Content negotiation</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../metadata">Metadata</a>
|
||||
<a href="../metadata/">Metadata</a>
|
||||
</li>
|
||||
|
||||
<li class="active" >
|
||||
<a href=".">Format suffixes</a>
|
||||
<a href="./">Format suffixes</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../reverse">Returning URLs</a>
|
||||
<a href="../reverse/">Returning URLs</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../exceptions">Exceptions</a>
|
||||
<a href="../exceptions/">Exceptions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../status-codes">Status codes</a>
|
||||
<a href="../status-codes/">Status codes</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../testing">Testing</a>
|
||||
<a href="../testing/">Testing</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../settings">Settings</a>
|
||||
<a href="../settings/">Settings</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -232,55 +235,55 @@
|
|||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../../topics/documenting-your-api">Documenting your API</a>
|
||||
<a href="../../topics/documenting-your-api/">Documenting your API</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/internationalization">Internationalization</a>
|
||||
<a href="../../topics/internationalization/">Internationalization</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/ajax-csrf-cors">AJAX, CSRF & CORS</a>
|
||||
<a href="../../topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/browser-enhancements">Browser enhancements</a>
|
||||
<a href="../../topics/browser-enhancements/">Browser Enhancements</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/browsable-api">The Browsable API</a>
|
||||
<a href="../../topics/browsable-api/">The Browsable API</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/rest-hypermedia-hateoas">REST, Hypermedia & HATEOAS</a>
|
||||
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/third-party-resources">Third Party Resources</a>
|
||||
<a href="../../topics/third-party-resources/">Third Party Resources</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/contributing">Contributing to REST framework</a>
|
||||
<a href="../../topics/contributing/">Contributing to REST framework</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/project-management">Project management</a>
|
||||
<a href="../../topics/project-management/">Project management</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/3.0-announcement">3.0 Announcement</a>
|
||||
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/3.1-announcement">3.1 Announcement</a>
|
||||
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/kickstarter-announcement">Kickstarter Announcement</a>
|
||||
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/release-notes">Release Notes</a>
|
||||
<a href="../../topics/release-notes/">Release Notes</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -300,27 +303,19 @@
|
|||
<div class="container-fluid">
|
||||
|
||||
<!-- Search Modal -->
|
||||
<div id="searchModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div id="mkdocs_search_modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3 id="myModalLabel">Documentation search</h3>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<!-- Custom google search -->
|
||||
<script>
|
||||
(function() {
|
||||
var cx = '015016005043623903336:rxraeohqk6w';
|
||||
var gcse = document.createElement('script');
|
||||
gcse.type = 'text/javascript';
|
||||
gcse.async = true;
|
||||
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
|
||||
'//www.google.com/cse/cse.js?cx=' + cx;
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(gcse, s);
|
||||
})();
|
||||
</script>
|
||||
<gcse:search></gcse:search>
|
||||
<form role="form">
|
||||
<div class="form-group">
|
||||
<input type="text" name="q" class="form-control" placeholder="Search..." id="mkdocs-search-query">
|
||||
</div>
|
||||
</form>
|
||||
<div id="mkdocs-search-results"></div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
|
|
@ -368,15 +363,18 @@
|
|||
</div>
|
||||
|
||||
<div id="main-content" class="span9">
|
||||
|
||||
|
||||
<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/urlpatterns.py">
|
||||
<span class="label label-info">urlpatterns.py</span>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<h1 id="format-suffixes">Format suffixes</h1>
|
||||
|
||||
|
||||
<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/urlpatterns.py">
|
||||
<span class="label label-info">urlpatterns.py</span>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<h1 id="format-suffixes">Format suffixes</h1>
|
||||
<blockquote>
|
||||
<p>Section 6.2.1 does not say that content negotiation should be
|
||||
used all the time.</p>
|
||||
|
|
@ -437,6 +435,8 @@ urlpatterns = i18n_patterns(
|
|||
<p>“That's why I always prefer extensions. Neither choice has anything to do with REST.” — Roy Fielding, <a href="http://tech.groups.yahoo.com/group/rest-discuss/message/14844">REST discuss mailing list</a></p>
|
||||
<p>The quote does not mention Accept headers, but it does make it clear that format suffixes should be considered an acceptable pattern.</p>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!--/span-->
|
||||
</div>
|
||||
|
|
@ -460,6 +460,8 @@ urlpatterns = i18n_patterns(
|
|||
<script src="../../js/jquery-1.8.1-min.js"></script>
|
||||
<script src="../../js/prettify-1.0.js"></script>
|
||||
<script src="../../js/bootstrap-2.1.1-min.js"></script>
|
||||
<script>var base_url = '../..';</script>
|
||||
<script src="../../mkdocs/js/require.js"></script>
|
||||
<script src="../../js/theme.js"></script>
|
||||
|
||||
<script>
|
||||
|
|
|
|||
|
|
@ -62,13 +62,13 @@
|
|||
<div class="navbar-inner">
|
||||
<div class="container-fluid">
|
||||
<a class="repo-link btn btn-primary btn-small" href="https://github.com/tomchristie/django-rest-framework/tree/master">GitHub</a>
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../viewsets">
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../viewsets/">
|
||||
Next <i class="icon-arrow-right icon-white"></i>
|
||||
</a>
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../views">
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../views/">
|
||||
<i class="icon-arrow-left icon-white"></i> Previous
|
||||
</a>
|
||||
<a class="repo-link btn btn-inverse btn-small" href="#searchModal" data-toggle="modal"><i class="icon-search icon-white"></i> Search</a>
|
||||
<a id="search_modal_show" class="repo-link btn btn-inverse btn-small" href="#mkdocs_search_modal" data-toggle="modal" data-target="#mkdocs_search_modal"><i class="icon-search icon-white"></i> Search</a>
|
||||
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
|
|
@ -79,38 +79,41 @@
|
|||
|
||||
<!-- Main navigation -->
|
||||
<ul class="nav navbar-nav">
|
||||
<li ><a href="/">Home</a></li>
|
||||
|
||||
<li >
|
||||
<a href="../..">Home</a>
|
||||
</li>
|
||||
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Tutorial <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/quickstart">Quickstart</a>
|
||||
<a href="../../tutorial/quickstart/">Quickstart</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/1-serialization">1 - Serialization</a>
|
||||
<a href="../../tutorial/1-serialization/">1 - Serialization</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/2-requests-and-responses">2 - Requests and responses</a>
|
||||
<a href="../../tutorial/2-requests-and-responses/">2 - Requests and responses</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/3-class-based-views">3 - Class based views</a>
|
||||
<a href="../../tutorial/3-class-based-views/">3 - Class based views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/4-authentication-and-permissions">4 - Authentication and permissions</a>
|
||||
<a href="../../tutorial/4-authentication-and-permissions/">4 - Authentication and permissions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/5-relationships-and-hyperlinked-apis">5 - Relationships and hyperlinked APIs</a>
|
||||
<a href="../../tutorial/5-relationships-and-hyperlinked-apis/">5 - Relationships and hyperlinked APIs</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/6-viewsets-and-routers">6 - Viewsets and routers</a>
|
||||
<a href="../../tutorial/6-viewsets-and-routers/">6 - Viewsets and routers</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -121,107 +124,107 @@
|
|||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../requests">Requests</a>
|
||||
<a href="../requests/">Requests</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../responses">Responses</a>
|
||||
<a href="../responses/">Responses</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../views">Views</a>
|
||||
<a href="../views/">Views</a>
|
||||
</li>
|
||||
|
||||
<li class="active" >
|
||||
<a href=".">Generic views</a>
|
||||
<a href="./">Generic views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../viewsets">Viewsets</a>
|
||||
<a href="../viewsets/">Viewsets</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../routers">Routers</a>
|
||||
<a href="../routers/">Routers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../parsers">Parsers</a>
|
||||
<a href="../parsers/">Parsers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../renderers">Renderers</a>
|
||||
<a href="../renderers/">Renderers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../serializers">Serializers</a>
|
||||
<a href="../serializers/">Serializers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../fields">Serializer fields</a>
|
||||
<a href="../fields/">Serializer fields</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../relations">Serializer relations</a>
|
||||
<a href="../relations/">Serializer relations</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../validators">Validators</a>
|
||||
<a href="../validators/">Validators</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../authentication">Authentication</a>
|
||||
<a href="../authentication/">Authentication</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../permissions">Permissions</a>
|
||||
<a href="../permissions/">Permissions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../throttling">Throttling</a>
|
||||
<a href="../throttling/">Throttling</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../filtering">Filtering</a>
|
||||
<a href="../filtering/">Filtering</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../pagination">Pagination</a>
|
||||
<a href="../pagination/">Pagination</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../versioning">Versioning</a>
|
||||
<a href="../versioning/">Versioning</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../content-negotiation">Content negotiation</a>
|
||||
<a href="../content-negotiation/">Content negotiation</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../metadata">Metadata</a>
|
||||
<a href="../metadata/">Metadata</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../format-suffixes">Format suffixes</a>
|
||||
<a href="../format-suffixes/">Format suffixes</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../reverse">Returning URLs</a>
|
||||
<a href="../reverse/">Returning URLs</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../exceptions">Exceptions</a>
|
||||
<a href="../exceptions/">Exceptions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../status-codes">Status codes</a>
|
||||
<a href="../status-codes/">Status codes</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../testing">Testing</a>
|
||||
<a href="../testing/">Testing</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../settings">Settings</a>
|
||||
<a href="../settings/">Settings</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -232,55 +235,55 @@
|
|||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../../topics/documenting-your-api">Documenting your API</a>
|
||||
<a href="../../topics/documenting-your-api/">Documenting your API</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/internationalization">Internationalization</a>
|
||||
<a href="../../topics/internationalization/">Internationalization</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/ajax-csrf-cors">AJAX, CSRF & CORS</a>
|
||||
<a href="../../topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/browser-enhancements">Browser enhancements</a>
|
||||
<a href="../../topics/browser-enhancements/">Browser Enhancements</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/browsable-api">The Browsable API</a>
|
||||
<a href="../../topics/browsable-api/">The Browsable API</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/rest-hypermedia-hateoas">REST, Hypermedia & HATEOAS</a>
|
||||
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/third-party-resources">Third Party Resources</a>
|
||||
<a href="../../topics/third-party-resources/">Third Party Resources</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/contributing">Contributing to REST framework</a>
|
||||
<a href="../../topics/contributing/">Contributing to REST framework</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/project-management">Project management</a>
|
||||
<a href="../../topics/project-management/">Project management</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/3.0-announcement">3.0 Announcement</a>
|
||||
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/3.1-announcement">3.1 Announcement</a>
|
||||
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/kickstarter-announcement">Kickstarter Announcement</a>
|
||||
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/release-notes">Release Notes</a>
|
||||
<a href="../../topics/release-notes/">Release Notes</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -300,27 +303,19 @@
|
|||
<div class="container-fluid">
|
||||
|
||||
<!-- Search Modal -->
|
||||
<div id="searchModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div id="mkdocs_search_modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3 id="myModalLabel">Documentation search</h3>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<!-- Custom google search -->
|
||||
<script>
|
||||
(function() {
|
||||
var cx = '015016005043623903336:rxraeohqk6w';
|
||||
var gcse = document.createElement('script');
|
||||
gcse.type = 'text/javascript';
|
||||
gcse.async = true;
|
||||
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
|
||||
'//www.google.com/cse/cse.js?cx=' + cx;
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(gcse, s);
|
||||
})();
|
||||
</script>
|
||||
<gcse:search></gcse:search>
|
||||
<form role="form">
|
||||
<div class="form-group">
|
||||
<input type="text" name="q" class="form-control" placeholder="Search..." id="mkdocs-search-query">
|
||||
</div>
|
||||
</form>
|
||||
<div id="mkdocs-search-results"></div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
|
|
@ -484,19 +479,22 @@
|
|||
</div>
|
||||
|
||||
<div id="main-content" class="span9">
|
||||
|
||||
|
||||
<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/mixins.py">
|
||||
<span class="label label-info">mixins.py</span>
|
||||
</a>
|
||||
|
||||
<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/generics.py">
|
||||
<span class="label label-info">generics.py</span>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<h1 id="generic-views">Generic views</h1>
|
||||
|
||||
|
||||
<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/mixins.py">
|
||||
<span class="label label-info">mixins.py</span>
|
||||
</a>
|
||||
|
||||
<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/generics.py">
|
||||
<span class="label label-info">generics.py</span>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<h1 id="generic-views">Generic views</h1>
|
||||
<blockquote>
|
||||
<p>Django’s generic views... were developed as a shortcut for common usage patterns... They take certain common idioms and patterns found in view development and abstract them so that you can quickly write common views of data without having to repeat yourself.</p>
|
||||
<p>— <a href="https://docs.djangoproject.com/en/dev/ref/class-based-views/#base-vs-generic-views">Django Documentation</a></p>
|
||||
|
|
@ -757,6 +755,8 @@ class BaseRetrieveUpdateDestroyView(MultipleFieldLookupMixin,
|
|||
<h2 id="django-rest-framework-bulk">Django REST Framework bulk</h2>
|
||||
<p>The <a href="https://github.com/miki725/django-rest-framework-bulk">django-rest-framework-bulk package</a> implements generic view mixins as well as some common concrete generic views to allow to apply bulk operations via API requests.</p>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!--/span-->
|
||||
</div>
|
||||
|
|
@ -780,6 +780,8 @@ class BaseRetrieveUpdateDestroyView(MultipleFieldLookupMixin,
|
|||
<script src="../../js/jquery-1.8.1-min.js"></script>
|
||||
<script src="../../js/prettify-1.0.js"></script>
|
||||
<script src="../../js/bootstrap-2.1.1-min.js"></script>
|
||||
<script>var base_url = '../..';</script>
|
||||
<script src="../../mkdocs/js/require.js"></script>
|
||||
<script src="../../js/theme.js"></script>
|
||||
|
||||
<script>
|
||||
|
|
|
|||
|
|
@ -62,13 +62,13 @@
|
|||
<div class="navbar-inner">
|
||||
<div class="container-fluid">
|
||||
<a class="repo-link btn btn-primary btn-small" href="https://github.com/tomchristie/django-rest-framework/tree/master">GitHub</a>
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../format-suffixes">
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../format-suffixes/">
|
||||
Next <i class="icon-arrow-right icon-white"></i>
|
||||
</a>
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../content-negotiation">
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../content-negotiation/">
|
||||
<i class="icon-arrow-left icon-white"></i> Previous
|
||||
</a>
|
||||
<a class="repo-link btn btn-inverse btn-small" href="#searchModal" data-toggle="modal"><i class="icon-search icon-white"></i> Search</a>
|
||||
<a id="search_modal_show" class="repo-link btn btn-inverse btn-small" href="#mkdocs_search_modal" data-toggle="modal" data-target="#mkdocs_search_modal"><i class="icon-search icon-white"></i> Search</a>
|
||||
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
|
|
@ -79,38 +79,41 @@
|
|||
|
||||
<!-- Main navigation -->
|
||||
<ul class="nav navbar-nav">
|
||||
<li ><a href="/">Home</a></li>
|
||||
|
||||
<li >
|
||||
<a href="../..">Home</a>
|
||||
</li>
|
||||
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Tutorial <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/quickstart">Quickstart</a>
|
||||
<a href="../../tutorial/quickstart/">Quickstart</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/1-serialization">1 - Serialization</a>
|
||||
<a href="../../tutorial/1-serialization/">1 - Serialization</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/2-requests-and-responses">2 - Requests and responses</a>
|
||||
<a href="../../tutorial/2-requests-and-responses/">2 - Requests and responses</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/3-class-based-views">3 - Class based views</a>
|
||||
<a href="../../tutorial/3-class-based-views/">3 - Class based views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/4-authentication-and-permissions">4 - Authentication and permissions</a>
|
||||
<a href="../../tutorial/4-authentication-and-permissions/">4 - Authentication and permissions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/5-relationships-and-hyperlinked-apis">5 - Relationships and hyperlinked APIs</a>
|
||||
<a href="../../tutorial/5-relationships-and-hyperlinked-apis/">5 - Relationships and hyperlinked APIs</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/6-viewsets-and-routers">6 - Viewsets and routers</a>
|
||||
<a href="../../tutorial/6-viewsets-and-routers/">6 - Viewsets and routers</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -121,107 +124,107 @@
|
|||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../requests">Requests</a>
|
||||
<a href="../requests/">Requests</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../responses">Responses</a>
|
||||
<a href="../responses/">Responses</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../views">Views</a>
|
||||
<a href="../views/">Views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../generic-views">Generic views</a>
|
||||
<a href="../generic-views/">Generic views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../viewsets">Viewsets</a>
|
||||
<a href="../viewsets/">Viewsets</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../routers">Routers</a>
|
||||
<a href="../routers/">Routers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../parsers">Parsers</a>
|
||||
<a href="../parsers/">Parsers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../renderers">Renderers</a>
|
||||
<a href="../renderers/">Renderers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../serializers">Serializers</a>
|
||||
<a href="../serializers/">Serializers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../fields">Serializer fields</a>
|
||||
<a href="../fields/">Serializer fields</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../relations">Serializer relations</a>
|
||||
<a href="../relations/">Serializer relations</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../validators">Validators</a>
|
||||
<a href="../validators/">Validators</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../authentication">Authentication</a>
|
||||
<a href="../authentication/">Authentication</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../permissions">Permissions</a>
|
||||
<a href="../permissions/">Permissions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../throttling">Throttling</a>
|
||||
<a href="../throttling/">Throttling</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../filtering">Filtering</a>
|
||||
<a href="../filtering/">Filtering</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../pagination">Pagination</a>
|
||||
<a href="../pagination/">Pagination</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../versioning">Versioning</a>
|
||||
<a href="../versioning/">Versioning</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../content-negotiation">Content negotiation</a>
|
||||
<a href="../content-negotiation/">Content negotiation</a>
|
||||
</li>
|
||||
|
||||
<li class="active" >
|
||||
<a href=".">Metadata</a>
|
||||
<a href="./">Metadata</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../format-suffixes">Format suffixes</a>
|
||||
<a href="../format-suffixes/">Format suffixes</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../reverse">Returning URLs</a>
|
||||
<a href="../reverse/">Returning URLs</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../exceptions">Exceptions</a>
|
||||
<a href="../exceptions/">Exceptions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../status-codes">Status codes</a>
|
||||
<a href="../status-codes/">Status codes</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../testing">Testing</a>
|
||||
<a href="../testing/">Testing</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../settings">Settings</a>
|
||||
<a href="../settings/">Settings</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -232,55 +235,55 @@
|
|||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../../topics/documenting-your-api">Documenting your API</a>
|
||||
<a href="../../topics/documenting-your-api/">Documenting your API</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/internationalization">Internationalization</a>
|
||||
<a href="../../topics/internationalization/">Internationalization</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/ajax-csrf-cors">AJAX, CSRF & CORS</a>
|
||||
<a href="../../topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/browser-enhancements">Browser enhancements</a>
|
||||
<a href="../../topics/browser-enhancements/">Browser Enhancements</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/browsable-api">The Browsable API</a>
|
||||
<a href="../../topics/browsable-api/">The Browsable API</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/rest-hypermedia-hateoas">REST, Hypermedia & HATEOAS</a>
|
||||
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/third-party-resources">Third Party Resources</a>
|
||||
<a href="../../topics/third-party-resources/">Third Party Resources</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/contributing">Contributing to REST framework</a>
|
||||
<a href="../../topics/contributing/">Contributing to REST framework</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/project-management">Project management</a>
|
||||
<a href="../../topics/project-management/">Project management</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/3.0-announcement">3.0 Announcement</a>
|
||||
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/3.1-announcement">3.1 Announcement</a>
|
||||
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/kickstarter-announcement">Kickstarter Announcement</a>
|
||||
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/release-notes">Release Notes</a>
|
||||
<a href="../../topics/release-notes/">Release Notes</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -300,27 +303,19 @@
|
|||
<div class="container-fluid">
|
||||
|
||||
<!-- Search Modal -->
|
||||
<div id="searchModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div id="mkdocs_search_modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3 id="myModalLabel">Documentation search</h3>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<!-- Custom google search -->
|
||||
<script>
|
||||
(function() {
|
||||
var cx = '015016005043623903336:rxraeohqk6w';
|
||||
var gcse = document.createElement('script');
|
||||
gcse.type = 'text/javascript';
|
||||
gcse.async = true;
|
||||
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
|
||||
'//www.google.com/cse/cse.js?cx=' + cx;
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(gcse, s);
|
||||
})();
|
||||
</script>
|
||||
<gcse:search></gcse:search>
|
||||
<form role="form">
|
||||
<div class="form-group">
|
||||
<input type="text" name="q" class="form-control" placeholder="Search..." id="mkdocs-search-query">
|
||||
</div>
|
||||
</form>
|
||||
<div id="mkdocs-search-results"></div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
|
|
@ -380,15 +375,18 @@
|
|||
</div>
|
||||
|
||||
<div id="main-content" class="span9">
|
||||
|
||||
|
||||
<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/metadata.py">
|
||||
<span class="label label-info">metadata.py</span>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<h1 id="metadata">Metadata</h1>
|
||||
|
||||
|
||||
<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/metadata.py">
|
||||
<span class="label label-info">metadata.py</span>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<h1 id="metadata">Metadata</h1>
|
||||
<blockquote>
|
||||
<p>[The <code>OPTIONS</code>] method allows a client to determine the options and/or requirements associated with a resource, or the capabilities of a server, without implying a resource action or initiating a resource retrieval.</p>
|
||||
<p>— <a href="http://tools.ietf.org/html/rfc7231#section-4.3.7">RFC7231, Section 4.3.7.</a></p>
|
||||
|
|
@ -469,6 +467,8 @@ def schema(self, request):
|
|||
}
|
||||
</code></pre>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!--/span-->
|
||||
</div>
|
||||
|
|
@ -492,6 +492,8 @@ def schema(self, request):
|
|||
<script src="../../js/jquery-1.8.1-min.js"></script>
|
||||
<script src="../../js/prettify-1.0.js"></script>
|
||||
<script src="../../js/bootstrap-2.1.1-min.js"></script>
|
||||
<script>var base_url = '../..';</script>
|
||||
<script src="../../mkdocs/js/require.js"></script>
|
||||
<script src="../../js/theme.js"></script>
|
||||
|
||||
<script>
|
||||
|
|
|
|||
|
|
@ -62,13 +62,13 @@
|
|||
<div class="navbar-inner">
|
||||
<div class="container-fluid">
|
||||
<a class="repo-link btn btn-primary btn-small" href="https://github.com/tomchristie/django-rest-framework/tree/master">GitHub</a>
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../versioning">
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../versioning/">
|
||||
Next <i class="icon-arrow-right icon-white"></i>
|
||||
</a>
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../filtering">
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../filtering/">
|
||||
<i class="icon-arrow-left icon-white"></i> Previous
|
||||
</a>
|
||||
<a class="repo-link btn btn-inverse btn-small" href="#searchModal" data-toggle="modal"><i class="icon-search icon-white"></i> Search</a>
|
||||
<a id="search_modal_show" class="repo-link btn btn-inverse btn-small" href="#mkdocs_search_modal" data-toggle="modal" data-target="#mkdocs_search_modal"><i class="icon-search icon-white"></i> Search</a>
|
||||
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
|
|
@ -79,38 +79,41 @@
|
|||
|
||||
<!-- Main navigation -->
|
||||
<ul class="nav navbar-nav">
|
||||
<li ><a href="/">Home</a></li>
|
||||
|
||||
<li >
|
||||
<a href="../..">Home</a>
|
||||
</li>
|
||||
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Tutorial <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/quickstart">Quickstart</a>
|
||||
<a href="../../tutorial/quickstart/">Quickstart</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/1-serialization">1 - Serialization</a>
|
||||
<a href="../../tutorial/1-serialization/">1 - Serialization</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/2-requests-and-responses">2 - Requests and responses</a>
|
||||
<a href="../../tutorial/2-requests-and-responses/">2 - Requests and responses</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/3-class-based-views">3 - Class based views</a>
|
||||
<a href="../../tutorial/3-class-based-views/">3 - Class based views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/4-authentication-and-permissions">4 - Authentication and permissions</a>
|
||||
<a href="../../tutorial/4-authentication-and-permissions/">4 - Authentication and permissions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/5-relationships-and-hyperlinked-apis">5 - Relationships and hyperlinked APIs</a>
|
||||
<a href="../../tutorial/5-relationships-and-hyperlinked-apis/">5 - Relationships and hyperlinked APIs</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/6-viewsets-and-routers">6 - Viewsets and routers</a>
|
||||
<a href="../../tutorial/6-viewsets-and-routers/">6 - Viewsets and routers</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -121,107 +124,107 @@
|
|||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../requests">Requests</a>
|
||||
<a href="../requests/">Requests</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../responses">Responses</a>
|
||||
<a href="../responses/">Responses</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../views">Views</a>
|
||||
<a href="../views/">Views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../generic-views">Generic views</a>
|
||||
<a href="../generic-views/">Generic views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../viewsets">Viewsets</a>
|
||||
<a href="../viewsets/">Viewsets</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../routers">Routers</a>
|
||||
<a href="../routers/">Routers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../parsers">Parsers</a>
|
||||
<a href="../parsers/">Parsers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../renderers">Renderers</a>
|
||||
<a href="../renderers/">Renderers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../serializers">Serializers</a>
|
||||
<a href="../serializers/">Serializers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../fields">Serializer fields</a>
|
||||
<a href="../fields/">Serializer fields</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../relations">Serializer relations</a>
|
||||
<a href="../relations/">Serializer relations</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../validators">Validators</a>
|
||||
<a href="../validators/">Validators</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../authentication">Authentication</a>
|
||||
<a href="../authentication/">Authentication</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../permissions">Permissions</a>
|
||||
<a href="../permissions/">Permissions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../throttling">Throttling</a>
|
||||
<a href="../throttling/">Throttling</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../filtering">Filtering</a>
|
||||
<a href="../filtering/">Filtering</a>
|
||||
</li>
|
||||
|
||||
<li class="active" >
|
||||
<a href=".">Pagination</a>
|
||||
<a href="./">Pagination</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../versioning">Versioning</a>
|
||||
<a href="../versioning/">Versioning</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../content-negotiation">Content negotiation</a>
|
||||
<a href="../content-negotiation/">Content negotiation</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../metadata">Metadata</a>
|
||||
<a href="../metadata/">Metadata</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../format-suffixes">Format suffixes</a>
|
||||
<a href="../format-suffixes/">Format suffixes</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../reverse">Returning URLs</a>
|
||||
<a href="../reverse/">Returning URLs</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../exceptions">Exceptions</a>
|
||||
<a href="../exceptions/">Exceptions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../status-codes">Status codes</a>
|
||||
<a href="../status-codes/">Status codes</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../testing">Testing</a>
|
||||
<a href="../testing/">Testing</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../settings">Settings</a>
|
||||
<a href="../settings/">Settings</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -232,55 +235,55 @@
|
|||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../../topics/documenting-your-api">Documenting your API</a>
|
||||
<a href="../../topics/documenting-your-api/">Documenting your API</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/internationalization">Internationalization</a>
|
||||
<a href="../../topics/internationalization/">Internationalization</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/ajax-csrf-cors">AJAX, CSRF & CORS</a>
|
||||
<a href="../../topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/browser-enhancements">Browser enhancements</a>
|
||||
<a href="../../topics/browser-enhancements/">Browser Enhancements</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/browsable-api">The Browsable API</a>
|
||||
<a href="../../topics/browsable-api/">The Browsable API</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/rest-hypermedia-hateoas">REST, Hypermedia & HATEOAS</a>
|
||||
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/third-party-resources">Third Party Resources</a>
|
||||
<a href="../../topics/third-party-resources/">Third Party Resources</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/contributing">Contributing to REST framework</a>
|
||||
<a href="../../topics/contributing/">Contributing to REST framework</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/project-management">Project management</a>
|
||||
<a href="../../topics/project-management/">Project management</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/3.0-announcement">3.0 Announcement</a>
|
||||
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/3.1-announcement">3.1 Announcement</a>
|
||||
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/kickstarter-announcement">Kickstarter Announcement</a>
|
||||
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/release-notes">Release Notes</a>
|
||||
<a href="../../topics/release-notes/">Release Notes</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -300,27 +303,19 @@
|
|||
<div class="container-fluid">
|
||||
|
||||
<!-- Search Modal -->
|
||||
<div id="searchModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div id="mkdocs_search_modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3 id="myModalLabel">Documentation search</h3>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<!-- Custom google search -->
|
||||
<script>
|
||||
(function() {
|
||||
var cx = '015016005043623903336:rxraeohqk6w';
|
||||
var gcse = document.createElement('script');
|
||||
gcse.type = 'text/javascript';
|
||||
gcse.async = true;
|
||||
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
|
||||
'//www.google.com/cse/cse.js?cx=' + cx;
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(gcse, s);
|
||||
})();
|
||||
</script>
|
||||
<gcse:search></gcse:search>
|
||||
<form role="form">
|
||||
<div class="form-group">
|
||||
<input type="text" name="q" class="form-control" placeholder="Search..." id="mkdocs-search-query">
|
||||
</div>
|
||||
</form>
|
||||
<div id="mkdocs-search-results"></div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
|
|
@ -432,15 +427,18 @@
|
|||
</div>
|
||||
|
||||
<div id="main-content" class="span9">
|
||||
|
||||
|
||||
<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/pagination.py">
|
||||
<span class="label label-info">pagination.py</span>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<h1 id="pagination">Pagination</h1>
|
||||
|
||||
|
||||
<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/pagination.py">
|
||||
<span class="label label-info">pagination.py</span>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<h1 id="pagination">Pagination</h1>
|
||||
<blockquote>
|
||||
<p>Django provides a few classes that help you manage paginated data – that is, data that’s split across several pages, with “Previous/Next” links.</p>
|
||||
<p>— <a href="https://docs.djangoproject.com/en/dev/topics/pagination/">Django documentation</a></p>
|
||||
|
|
@ -652,7 +650,7 @@ class StandardResultsSetPagination(PageNumberPagination):
|
|||
</code></pre>
|
||||
<p>API responses for list endpoints will now include a <code>Link</code> header, instead of including the pagination links as part of the body of the response, for example:</p>
|
||||
<hr />
|
||||
<p><img alt="Link Header" src="../../../img/link-header-pagination.png" /></p>
|
||||
<p><img alt="Link Header" src="../../img/link-header-pagination.png" /></p>
|
||||
<p><em>A custom pagination style, using the 'Link' header'</em></p>
|
||||
<hr />
|
||||
<h1 id="html-pagination-controls">HTML pagination controls</h1>
|
||||
|
|
@ -674,6 +672,8 @@ class StandardResultsSetPagination(PageNumberPagination):
|
|||
<h2 id="drf-extensions">DRF-extensions</h2>
|
||||
<p>The <a href="http://chibisov.github.io/drf-extensions/docs/"><code>DRF-extensions</code> package</a> includes a <a href="http://chibisov.github.io/drf-extensions/docs/#paginatebymaxmixin"><code>PaginateByMaxMixin</code> mixin class</a> that allows your API clients to specify <code>?page_size=max</code> to obtain the maximum allowed page size.</p>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!--/span-->
|
||||
</div>
|
||||
|
|
@ -697,6 +697,8 @@ class StandardResultsSetPagination(PageNumberPagination):
|
|||
<script src="../../js/jquery-1.8.1-min.js"></script>
|
||||
<script src="../../js/prettify-1.0.js"></script>
|
||||
<script src="../../js/bootstrap-2.1.1-min.js"></script>
|
||||
<script>var base_url = '../..';</script>
|
||||
<script src="../../mkdocs/js/require.js"></script>
|
||||
<script src="../../js/theme.js"></script>
|
||||
|
||||
<script>
|
||||
|
|
|
|||
|
|
@ -62,13 +62,13 @@
|
|||
<div class="navbar-inner">
|
||||
<div class="container-fluid">
|
||||
<a class="repo-link btn btn-primary btn-small" href="https://github.com/tomchristie/django-rest-framework/tree/master">GitHub</a>
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../renderers">
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../renderers/">
|
||||
Next <i class="icon-arrow-right icon-white"></i>
|
||||
</a>
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../routers">
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../routers/">
|
||||
<i class="icon-arrow-left icon-white"></i> Previous
|
||||
</a>
|
||||
<a class="repo-link btn btn-inverse btn-small" href="#searchModal" data-toggle="modal"><i class="icon-search icon-white"></i> Search</a>
|
||||
<a id="search_modal_show" class="repo-link btn btn-inverse btn-small" href="#mkdocs_search_modal" data-toggle="modal" data-target="#mkdocs_search_modal"><i class="icon-search icon-white"></i> Search</a>
|
||||
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
|
|
@ -79,38 +79,41 @@
|
|||
|
||||
<!-- Main navigation -->
|
||||
<ul class="nav navbar-nav">
|
||||
<li ><a href="/">Home</a></li>
|
||||
|
||||
<li >
|
||||
<a href="../..">Home</a>
|
||||
</li>
|
||||
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Tutorial <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/quickstart">Quickstart</a>
|
||||
<a href="../../tutorial/quickstart/">Quickstart</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/1-serialization">1 - Serialization</a>
|
||||
<a href="../../tutorial/1-serialization/">1 - Serialization</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/2-requests-and-responses">2 - Requests and responses</a>
|
||||
<a href="../../tutorial/2-requests-and-responses/">2 - Requests and responses</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/3-class-based-views">3 - Class based views</a>
|
||||
<a href="../../tutorial/3-class-based-views/">3 - Class based views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/4-authentication-and-permissions">4 - Authentication and permissions</a>
|
||||
<a href="../../tutorial/4-authentication-and-permissions/">4 - Authentication and permissions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/5-relationships-and-hyperlinked-apis">5 - Relationships and hyperlinked APIs</a>
|
||||
<a href="../../tutorial/5-relationships-and-hyperlinked-apis/">5 - Relationships and hyperlinked APIs</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/6-viewsets-and-routers">6 - Viewsets and routers</a>
|
||||
<a href="../../tutorial/6-viewsets-and-routers/">6 - Viewsets and routers</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -121,107 +124,107 @@
|
|||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../requests">Requests</a>
|
||||
<a href="../requests/">Requests</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../responses">Responses</a>
|
||||
<a href="../responses/">Responses</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../views">Views</a>
|
||||
<a href="../views/">Views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../generic-views">Generic views</a>
|
||||
<a href="../generic-views/">Generic views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../viewsets">Viewsets</a>
|
||||
<a href="../viewsets/">Viewsets</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../routers">Routers</a>
|
||||
<a href="../routers/">Routers</a>
|
||||
</li>
|
||||
|
||||
<li class="active" >
|
||||
<a href=".">Parsers</a>
|
||||
<a href="./">Parsers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../renderers">Renderers</a>
|
||||
<a href="../renderers/">Renderers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../serializers">Serializers</a>
|
||||
<a href="../serializers/">Serializers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../fields">Serializer fields</a>
|
||||
<a href="../fields/">Serializer fields</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../relations">Serializer relations</a>
|
||||
<a href="../relations/">Serializer relations</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../validators">Validators</a>
|
||||
<a href="../validators/">Validators</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../authentication">Authentication</a>
|
||||
<a href="../authentication/">Authentication</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../permissions">Permissions</a>
|
||||
<a href="../permissions/">Permissions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../throttling">Throttling</a>
|
||||
<a href="../throttling/">Throttling</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../filtering">Filtering</a>
|
||||
<a href="../filtering/">Filtering</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../pagination">Pagination</a>
|
||||
<a href="../pagination/">Pagination</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../versioning">Versioning</a>
|
||||
<a href="../versioning/">Versioning</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../content-negotiation">Content negotiation</a>
|
||||
<a href="../content-negotiation/">Content negotiation</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../metadata">Metadata</a>
|
||||
<a href="../metadata/">Metadata</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../format-suffixes">Format suffixes</a>
|
||||
<a href="../format-suffixes/">Format suffixes</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../reverse">Returning URLs</a>
|
||||
<a href="../reverse/">Returning URLs</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../exceptions">Exceptions</a>
|
||||
<a href="../exceptions/">Exceptions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../status-codes">Status codes</a>
|
||||
<a href="../status-codes/">Status codes</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../testing">Testing</a>
|
||||
<a href="../testing/">Testing</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../settings">Settings</a>
|
||||
<a href="../settings/">Settings</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -232,55 +235,55 @@
|
|||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../../topics/documenting-your-api">Documenting your API</a>
|
||||
<a href="../../topics/documenting-your-api/">Documenting your API</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/internationalization">Internationalization</a>
|
||||
<a href="../../topics/internationalization/">Internationalization</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/ajax-csrf-cors">AJAX, CSRF & CORS</a>
|
||||
<a href="../../topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/browser-enhancements">Browser enhancements</a>
|
||||
<a href="../../topics/browser-enhancements/">Browser Enhancements</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/browsable-api">The Browsable API</a>
|
||||
<a href="../../topics/browsable-api/">The Browsable API</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/rest-hypermedia-hateoas">REST, Hypermedia & HATEOAS</a>
|
||||
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/third-party-resources">Third Party Resources</a>
|
||||
<a href="../../topics/third-party-resources/">Third Party Resources</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/contributing">Contributing to REST framework</a>
|
||||
<a href="../../topics/contributing/">Contributing to REST framework</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/project-management">Project management</a>
|
||||
<a href="../../topics/project-management/">Project management</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/3.0-announcement">3.0 Announcement</a>
|
||||
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/3.1-announcement">3.1 Announcement</a>
|
||||
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/kickstarter-announcement">Kickstarter Announcement</a>
|
||||
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/release-notes">Release Notes</a>
|
||||
<a href="../../topics/release-notes/">Release Notes</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -300,27 +303,19 @@
|
|||
<div class="container-fluid">
|
||||
|
||||
<!-- Search Modal -->
|
||||
<div id="searchModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div id="mkdocs_search_modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3 id="myModalLabel">Documentation search</h3>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<!-- Custom google search -->
|
||||
<script>
|
||||
(function() {
|
||||
var cx = '015016005043623903336:rxraeohqk6w';
|
||||
var gcse = document.createElement('script');
|
||||
gcse.type = 'text/javascript';
|
||||
gcse.async = true;
|
||||
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
|
||||
'//www.google.com/cse/cse.js?cx=' + cx;
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(gcse, s);
|
||||
})();
|
||||
</script>
|
||||
<gcse:search></gcse:search>
|
||||
<form role="form">
|
||||
<div class="form-group">
|
||||
<input type="text" name="q" class="form-control" placeholder="Search..." id="mkdocs-search-query">
|
||||
</div>
|
||||
</form>
|
||||
<div id="mkdocs-search-results"></div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
|
|
@ -440,15 +435,18 @@
|
|||
</div>
|
||||
|
||||
<div id="main-content" class="span9">
|
||||
|
||||
|
||||
<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/parsers.py">
|
||||
<span class="label label-info">parsers.py</span>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<h1 id="parsers">Parsers</h1>
|
||||
|
||||
|
||||
<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/parsers.py">
|
||||
<span class="label label-info">parsers.py</span>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<h1 id="parsers">Parsers</h1>
|
||||
<blockquote>
|
||||
<p>Machine interacting web services tend to use more
|
||||
structured formats for sending data than form-encoded, since they're
|
||||
|
|
@ -597,6 +595,8 @@ def parse(self, stream, media_type=None, parser_context=None):
|
|||
<h2 id="camelcase-json">CamelCase JSON</h2>
|
||||
<p><a href="https://github.com/vbabiy/djangorestframework-camel-case">djangorestframework-camel-case</a> provides camel case JSON renderers and parsers for REST framework. This allows serializers to use Python-style underscored field names, but be exposed in the API as Javascript-style camel case field names. It is maintained by <a href="https://github.com/vbabiy">Vitaly Babiy</a>.</p>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!--/span-->
|
||||
</div>
|
||||
|
|
@ -620,6 +620,8 @@ def parse(self, stream, media_type=None, parser_context=None):
|
|||
<script src="../../js/jquery-1.8.1-min.js"></script>
|
||||
<script src="../../js/prettify-1.0.js"></script>
|
||||
<script src="../../js/bootstrap-2.1.1-min.js"></script>
|
||||
<script>var base_url = '../..';</script>
|
||||
<script src="../../mkdocs/js/require.js"></script>
|
||||
<script src="../../js/theme.js"></script>
|
||||
|
||||
<script>
|
||||
|
|
|
|||
|
|
@ -62,13 +62,13 @@
|
|||
<div class="navbar-inner">
|
||||
<div class="container-fluid">
|
||||
<a class="repo-link btn btn-primary btn-small" href="https://github.com/tomchristie/django-rest-framework/tree/master">GitHub</a>
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../throttling">
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../throttling/">
|
||||
Next <i class="icon-arrow-right icon-white"></i>
|
||||
</a>
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../authentication">
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../authentication/">
|
||||
<i class="icon-arrow-left icon-white"></i> Previous
|
||||
</a>
|
||||
<a class="repo-link btn btn-inverse btn-small" href="#searchModal" data-toggle="modal"><i class="icon-search icon-white"></i> Search</a>
|
||||
<a id="search_modal_show" class="repo-link btn btn-inverse btn-small" href="#mkdocs_search_modal" data-toggle="modal" data-target="#mkdocs_search_modal"><i class="icon-search icon-white"></i> Search</a>
|
||||
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
|
|
@ -79,38 +79,41 @@
|
|||
|
||||
<!-- Main navigation -->
|
||||
<ul class="nav navbar-nav">
|
||||
<li ><a href="/">Home</a></li>
|
||||
|
||||
<li >
|
||||
<a href="../..">Home</a>
|
||||
</li>
|
||||
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Tutorial <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/quickstart">Quickstart</a>
|
||||
<a href="../../tutorial/quickstart/">Quickstart</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/1-serialization">1 - Serialization</a>
|
||||
<a href="../../tutorial/1-serialization/">1 - Serialization</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/2-requests-and-responses">2 - Requests and responses</a>
|
||||
<a href="../../tutorial/2-requests-and-responses/">2 - Requests and responses</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/3-class-based-views">3 - Class based views</a>
|
||||
<a href="../../tutorial/3-class-based-views/">3 - Class based views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/4-authentication-and-permissions">4 - Authentication and permissions</a>
|
||||
<a href="../../tutorial/4-authentication-and-permissions/">4 - Authentication and permissions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/5-relationships-and-hyperlinked-apis">5 - Relationships and hyperlinked APIs</a>
|
||||
<a href="../../tutorial/5-relationships-and-hyperlinked-apis/">5 - Relationships and hyperlinked APIs</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/6-viewsets-and-routers">6 - Viewsets and routers</a>
|
||||
<a href="../../tutorial/6-viewsets-and-routers/">6 - Viewsets and routers</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -121,107 +124,107 @@
|
|||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../requests">Requests</a>
|
||||
<a href="../requests/">Requests</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../responses">Responses</a>
|
||||
<a href="../responses/">Responses</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../views">Views</a>
|
||||
<a href="../views/">Views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../generic-views">Generic views</a>
|
||||
<a href="../generic-views/">Generic views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../viewsets">Viewsets</a>
|
||||
<a href="../viewsets/">Viewsets</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../routers">Routers</a>
|
||||
<a href="../routers/">Routers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../parsers">Parsers</a>
|
||||
<a href="../parsers/">Parsers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../renderers">Renderers</a>
|
||||
<a href="../renderers/">Renderers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../serializers">Serializers</a>
|
||||
<a href="../serializers/">Serializers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../fields">Serializer fields</a>
|
||||
<a href="../fields/">Serializer fields</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../relations">Serializer relations</a>
|
||||
<a href="../relations/">Serializer relations</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../validators">Validators</a>
|
||||
<a href="../validators/">Validators</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../authentication">Authentication</a>
|
||||
<a href="../authentication/">Authentication</a>
|
||||
</li>
|
||||
|
||||
<li class="active" >
|
||||
<a href=".">Permissions</a>
|
||||
<a href="./">Permissions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../throttling">Throttling</a>
|
||||
<a href="../throttling/">Throttling</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../filtering">Filtering</a>
|
||||
<a href="../filtering/">Filtering</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../pagination">Pagination</a>
|
||||
<a href="../pagination/">Pagination</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../versioning">Versioning</a>
|
||||
<a href="../versioning/">Versioning</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../content-negotiation">Content negotiation</a>
|
||||
<a href="../content-negotiation/">Content negotiation</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../metadata">Metadata</a>
|
||||
<a href="../metadata/">Metadata</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../format-suffixes">Format suffixes</a>
|
||||
<a href="../format-suffixes/">Format suffixes</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../reverse">Returning URLs</a>
|
||||
<a href="../reverse/">Returning URLs</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../exceptions">Exceptions</a>
|
||||
<a href="../exceptions/">Exceptions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../status-codes">Status codes</a>
|
||||
<a href="../status-codes/">Status codes</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../testing">Testing</a>
|
||||
<a href="../testing/">Testing</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../settings">Settings</a>
|
||||
<a href="../settings/">Settings</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -232,55 +235,55 @@
|
|||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../../topics/documenting-your-api">Documenting your API</a>
|
||||
<a href="../../topics/documenting-your-api/">Documenting your API</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/internationalization">Internationalization</a>
|
||||
<a href="../../topics/internationalization/">Internationalization</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/ajax-csrf-cors">AJAX, CSRF & CORS</a>
|
||||
<a href="../../topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/browser-enhancements">Browser enhancements</a>
|
||||
<a href="../../topics/browser-enhancements/">Browser Enhancements</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/browsable-api">The Browsable API</a>
|
||||
<a href="../../topics/browsable-api/">The Browsable API</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/rest-hypermedia-hateoas">REST, Hypermedia & HATEOAS</a>
|
||||
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/third-party-resources">Third Party Resources</a>
|
||||
<a href="../../topics/third-party-resources/">Third Party Resources</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/contributing">Contributing to REST framework</a>
|
||||
<a href="../../topics/contributing/">Contributing to REST framework</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/project-management">Project management</a>
|
||||
<a href="../../topics/project-management/">Project management</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/3.0-announcement">3.0 Announcement</a>
|
||||
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/3.1-announcement">3.1 Announcement</a>
|
||||
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/kickstarter-announcement">Kickstarter Announcement</a>
|
||||
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/release-notes">Release Notes</a>
|
||||
<a href="../../topics/release-notes/">Release Notes</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -300,27 +303,19 @@
|
|||
<div class="container-fluid">
|
||||
|
||||
<!-- Search Modal -->
|
||||
<div id="searchModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div id="mkdocs_search_modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3 id="myModalLabel">Documentation search</h3>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<!-- Custom google search -->
|
||||
<script>
|
||||
(function() {
|
||||
var cx = '015016005043623903336:rxraeohqk6w';
|
||||
var gcse = document.createElement('script');
|
||||
gcse.type = 'text/javascript';
|
||||
gcse.async = true;
|
||||
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
|
||||
'//www.google.com/cse/cse.js?cx=' + cx;
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(gcse, s);
|
||||
})();
|
||||
</script>
|
||||
<gcse:search></gcse:search>
|
||||
<form role="form">
|
||||
<div class="form-group">
|
||||
<input type="text" name="q" class="form-control" placeholder="Search..." id="mkdocs-search-query">
|
||||
</div>
|
||||
</form>
|
||||
<div id="mkdocs-search-results"></div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
|
|
@ -417,10 +412,6 @@
|
|||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<a href="#drf-any-permissions">DRF Any Permissions</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="#composed-permissions">Composed Permissions</a>
|
||||
</li>
|
||||
|
|
@ -440,20 +431,23 @@
|
|||
</div>
|
||||
|
||||
<div id="main-content" class="span9">
|
||||
|
||||
|
||||
<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/permissions.py">
|
||||
<span class="label label-info">permissions.py</span>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<h1 id="permissions">Permissions</h1>
|
||||
|
||||
|
||||
<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/permissions.py">
|
||||
<span class="label label-info">permissions.py</span>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<h1 id="permissions">Permissions</h1>
|
||||
<blockquote>
|
||||
<p>Authentication or identification by itself is not usually sufficient to gain access to information or code. For that, the entity requesting access must have authorization.</p>
|
||||
<p>— <a href="https://developer.apple.com/library/mac/#documentation/security/Conceptual/AuthenticationAndAuthorizationGuide/Authorization/Authorization.html">Apple Developer Documentation</a></p>
|
||||
</blockquote>
|
||||
<p>Together with <a href="../authentication">authentication</a> and <a href="../throttling">throttling</a>, permissions determine whether a request should be granted or denied access.</p>
|
||||
<p>Together with <a href="../authentication/">authentication</a> and <a href="../throttling/">throttling</a>, permissions determine whether a request should be granted or denied access.</p>
|
||||
<p>Permission checks are always run at the very start of the view, before any other code is allowed to proceed. Permission checks will typically use the authentication information in the <code>request.user</code> and <code>request.auth</code> properties to determine if the incoming request should be permitted.</p>
|
||||
<p>Permissions are used to grant or deny access different classes of users to different parts of the API.</p>
|
||||
<p>The simplest style of permission would be to allow access to any authenticated user, and deny access to any unauthenticated user. This corresponds the <code>IsAuthenticated</code> class in REST framework.</p>
|
||||
|
|
@ -483,7 +477,7 @@ or if you override the <code>get_object</code> method on a generic view, then yo
|
|||
</code></pre>
|
||||
<h4 id="limitations-of-object-level-permissions">Limitations of object level permissions</h4>
|
||||
<p>For performance reasons the generic views will not automatically apply object level permissions to each instance in a queryset when returning a list of objects.</p>
|
||||
<p>Often when you're using object level permissions you'll also want to <a href="../filtering">filter the queryset</a> appropriately, to ensure that users only have visibility onto instances that they are permitted to view.</p>
|
||||
<p>Often when you're using object level permissions you'll also want to <a href="../filtering/">filter the queryset</a> appropriately, to ensure that users only have visibility onto instances that they are permitted to view.</p>
|
||||
<h2 id="setting-the-permission-policy">Setting the permission policy</h2>
|
||||
<p>The default permission policy may be set globally, using the <code>DEFAULT_PERMISSION_CLASSES</code> setting. For example.</p>
|
||||
<pre><code>REST_FRAMEWORK = {
|
||||
|
|
@ -611,17 +605,17 @@ class BlacklistPermission(permissions.BasePermission):
|
|||
return obj.owner == request.user
|
||||
</code></pre>
|
||||
<p>Note that the generic views will check the appropriate object level permissions, but if you're writing your own custom views, you'll need to make sure you check the object level permission checks yourself. You can do so by calling <code>self.check_object_permissions(request, obj)</code> from the view once you have the object instance. This call will raise an appropriate <code>APIException</code> if any object-level permission checks fail, and will otherwise simply return.</p>
|
||||
<p>Also note that the generic views will only check the object-level permissions for views that retrieve a single model instance. If you require object-level filtering of list views, you'll need to filter the queryset separately. See the <a href="../filtering">filtering documentation</a> for more details.</p>
|
||||
<p>Also note that the generic views will only check the object-level permissions for views that retrieve a single model instance. If you require object-level filtering of list views, you'll need to filter the queryset separately. See the <a href="../filtering/">filtering documentation</a> for more details.</p>
|
||||
<hr />
|
||||
<h1 id="third-party-packages">Third party packages</h1>
|
||||
<p>The following third party packages are also available.</p>
|
||||
<h2 id="drf-any-permissions">DRF Any Permissions</h2>
|
||||
<p>The <a href="https://github.com/kevin-brown/drf-any-permissions">DRF Any Permissions</a> packages provides a different permission behavior in contrast to REST framework. Instead of all specified permissions being required, only one of the given permissions has to be true in order to get access to the view.</p>
|
||||
<h2 id="composed-permissions">Composed Permissions</h2>
|
||||
<p>The <a href="https://github.com/niwibe/djangorestframework-composed-permissions">Composed Permissions</a> package provides a simple way to define complex and multi-depth (with logic operators) permission objects, using small and reusable components.</p>
|
||||
<h2 id="rest-condition">REST Condition</h2>
|
||||
<p>The <a href="https://github.com/caxap/rest_condition">REST Condition</a> package is another extension for building complex permissions in a simple and convenient way. The extension allows you to combine permissions with logical operators.</p>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!--/span-->
|
||||
</div>
|
||||
|
|
@ -645,6 +639,8 @@ class BlacklistPermission(permissions.BasePermission):
|
|||
<script src="../../js/jquery-1.8.1-min.js"></script>
|
||||
<script src="../../js/prettify-1.0.js"></script>
|
||||
<script src="../../js/bootstrap-2.1.1-min.js"></script>
|
||||
<script>var base_url = '../..';</script>
|
||||
<script src="../../mkdocs/js/require.js"></script>
|
||||
<script src="../../js/theme.js"></script>
|
||||
|
||||
<script>
|
||||
|
|
|
|||
|
|
@ -62,13 +62,13 @@
|
|||
<div class="navbar-inner">
|
||||
<div class="container-fluid">
|
||||
<a class="repo-link btn btn-primary btn-small" href="https://github.com/tomchristie/django-rest-framework/tree/master">GitHub</a>
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../validators">
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../validators/">
|
||||
Next <i class="icon-arrow-right icon-white"></i>
|
||||
</a>
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../fields">
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../fields/">
|
||||
<i class="icon-arrow-left icon-white"></i> Previous
|
||||
</a>
|
||||
<a class="repo-link btn btn-inverse btn-small" href="#searchModal" data-toggle="modal"><i class="icon-search icon-white"></i> Search</a>
|
||||
<a id="search_modal_show" class="repo-link btn btn-inverse btn-small" href="#mkdocs_search_modal" data-toggle="modal" data-target="#mkdocs_search_modal"><i class="icon-search icon-white"></i> Search</a>
|
||||
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
|
|
@ -79,38 +79,41 @@
|
|||
|
||||
<!-- Main navigation -->
|
||||
<ul class="nav navbar-nav">
|
||||
<li ><a href="/">Home</a></li>
|
||||
|
||||
<li >
|
||||
<a href="../..">Home</a>
|
||||
</li>
|
||||
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Tutorial <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/quickstart">Quickstart</a>
|
||||
<a href="../../tutorial/quickstart/">Quickstart</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/1-serialization">1 - Serialization</a>
|
||||
<a href="../../tutorial/1-serialization/">1 - Serialization</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/2-requests-and-responses">2 - Requests and responses</a>
|
||||
<a href="../../tutorial/2-requests-and-responses/">2 - Requests and responses</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/3-class-based-views">3 - Class based views</a>
|
||||
<a href="../../tutorial/3-class-based-views/">3 - Class based views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/4-authentication-and-permissions">4 - Authentication and permissions</a>
|
||||
<a href="../../tutorial/4-authentication-and-permissions/">4 - Authentication and permissions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/5-relationships-and-hyperlinked-apis">5 - Relationships and hyperlinked APIs</a>
|
||||
<a href="../../tutorial/5-relationships-and-hyperlinked-apis/">5 - Relationships and hyperlinked APIs</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/6-viewsets-and-routers">6 - Viewsets and routers</a>
|
||||
<a href="../../tutorial/6-viewsets-and-routers/">6 - Viewsets and routers</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -121,107 +124,107 @@
|
|||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../requests">Requests</a>
|
||||
<a href="../requests/">Requests</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../responses">Responses</a>
|
||||
<a href="../responses/">Responses</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../views">Views</a>
|
||||
<a href="../views/">Views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../generic-views">Generic views</a>
|
||||
<a href="../generic-views/">Generic views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../viewsets">Viewsets</a>
|
||||
<a href="../viewsets/">Viewsets</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../routers">Routers</a>
|
||||
<a href="../routers/">Routers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../parsers">Parsers</a>
|
||||
<a href="../parsers/">Parsers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../renderers">Renderers</a>
|
||||
<a href="../renderers/">Renderers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../serializers">Serializers</a>
|
||||
<a href="../serializers/">Serializers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../fields">Serializer fields</a>
|
||||
<a href="../fields/">Serializer fields</a>
|
||||
</li>
|
||||
|
||||
<li class="active" >
|
||||
<a href=".">Serializer relations</a>
|
||||
<a href="./">Serializer relations</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../validators">Validators</a>
|
||||
<a href="../validators/">Validators</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../authentication">Authentication</a>
|
||||
<a href="../authentication/">Authentication</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../permissions">Permissions</a>
|
||||
<a href="../permissions/">Permissions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../throttling">Throttling</a>
|
||||
<a href="../throttling/">Throttling</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../filtering">Filtering</a>
|
||||
<a href="../filtering/">Filtering</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../pagination">Pagination</a>
|
||||
<a href="../pagination/">Pagination</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../versioning">Versioning</a>
|
||||
<a href="../versioning/">Versioning</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../content-negotiation">Content negotiation</a>
|
||||
<a href="../content-negotiation/">Content negotiation</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../metadata">Metadata</a>
|
||||
<a href="../metadata/">Metadata</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../format-suffixes">Format suffixes</a>
|
||||
<a href="../format-suffixes/">Format suffixes</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../reverse">Returning URLs</a>
|
||||
<a href="../reverse/">Returning URLs</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../exceptions">Exceptions</a>
|
||||
<a href="../exceptions/">Exceptions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../status-codes">Status codes</a>
|
||||
<a href="../status-codes/">Status codes</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../testing">Testing</a>
|
||||
<a href="../testing/">Testing</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../settings">Settings</a>
|
||||
<a href="../settings/">Settings</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -232,55 +235,55 @@
|
|||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../../topics/documenting-your-api">Documenting your API</a>
|
||||
<a href="../../topics/documenting-your-api/">Documenting your API</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/internationalization">Internationalization</a>
|
||||
<a href="../../topics/internationalization/">Internationalization</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/ajax-csrf-cors">AJAX, CSRF & CORS</a>
|
||||
<a href="../../topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/browser-enhancements">Browser enhancements</a>
|
||||
<a href="../../topics/browser-enhancements/">Browser Enhancements</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/browsable-api">The Browsable API</a>
|
||||
<a href="../../topics/browsable-api/">The Browsable API</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/rest-hypermedia-hateoas">REST, Hypermedia & HATEOAS</a>
|
||||
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/third-party-resources">Third Party Resources</a>
|
||||
<a href="../../topics/third-party-resources/">Third Party Resources</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/contributing">Contributing to REST framework</a>
|
||||
<a href="../../topics/contributing/">Contributing to REST framework</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/project-management">Project management</a>
|
||||
<a href="../../topics/project-management/">Project management</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/3.0-announcement">3.0 Announcement</a>
|
||||
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/3.1-announcement">3.1 Announcement</a>
|
||||
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/kickstarter-announcement">Kickstarter Announcement</a>
|
||||
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/release-notes">Release Notes</a>
|
||||
<a href="../../topics/release-notes/">Release Notes</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -300,27 +303,19 @@
|
|||
<div class="container-fluid">
|
||||
|
||||
<!-- Search Modal -->
|
||||
<div id="searchModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div id="mkdocs_search_modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3 id="myModalLabel">Documentation search</h3>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<!-- Custom google search -->
|
||||
<script>
|
||||
(function() {
|
||||
var cx = '015016005043623903336:rxraeohqk6w';
|
||||
var gcse = document.createElement('script');
|
||||
gcse.type = 'text/javascript';
|
||||
gcse.async = true;
|
||||
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
|
||||
'//www.google.com/cse/cse.js?cx=' + cx;
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(gcse, s);
|
||||
})();
|
||||
</script>
|
||||
<gcse:search></gcse:search>
|
||||
<form role="form">
|
||||
<div class="form-group">
|
||||
<input type="text" name="q" class="form-control" placeholder="Search..." id="mkdocs-search-query">
|
||||
</div>
|
||||
</form>
|
||||
<div id="mkdocs-search-results"></div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
|
|
@ -456,15 +451,18 @@
|
|||
</div>
|
||||
|
||||
<div id="main-content" class="span9">
|
||||
|
||||
|
||||
<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/relations.py">
|
||||
<span class="label label-info">relations.py</span>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<h1 id="serializer-relations">Serializer relations</h1>
|
||||
|
||||
|
||||
<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/relations.py">
|
||||
<span class="label label-info">relations.py</span>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<h1 id="serializer-relations">Serializer relations</h1>
|
||||
<blockquote>
|
||||
<p>Bad programmers worry about the code.
|
||||
Good programmers worry about data structures and their relationships.</p>
|
||||
|
|
@ -841,6 +839,8 @@ attributes are not configured to correctly match the URL conf.</p>
|
|||
<h2 id="drf-nested-routers">DRF Nested Routers</h2>
|
||||
<p>The <a href="https://github.com/alanjds/drf-nested-routers">drf-nested-routers package</a> provides routers and relationship fields for working with nested resources.</p>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!--/span-->
|
||||
</div>
|
||||
|
|
@ -864,6 +864,8 @@ attributes are not configured to correctly match the URL conf.</p>
|
|||
<script src="../../js/jquery-1.8.1-min.js"></script>
|
||||
<script src="../../js/prettify-1.0.js"></script>
|
||||
<script src="../../js/bootstrap-2.1.1-min.js"></script>
|
||||
<script>var base_url = '../..';</script>
|
||||
<script src="../../mkdocs/js/require.js"></script>
|
||||
<script src="../../js/theme.js"></script>
|
||||
|
||||
<script>
|
||||
|
|
|
|||
|
|
@ -62,13 +62,13 @@
|
|||
<div class="navbar-inner">
|
||||
<div class="container-fluid">
|
||||
<a class="repo-link btn btn-primary btn-small" href="https://github.com/tomchristie/django-rest-framework/tree/master">GitHub</a>
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../serializers">
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../serializers/">
|
||||
Next <i class="icon-arrow-right icon-white"></i>
|
||||
</a>
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../parsers">
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../parsers/">
|
||||
<i class="icon-arrow-left icon-white"></i> Previous
|
||||
</a>
|
||||
<a class="repo-link btn btn-inverse btn-small" href="#searchModal" data-toggle="modal"><i class="icon-search icon-white"></i> Search</a>
|
||||
<a id="search_modal_show" class="repo-link btn btn-inverse btn-small" href="#mkdocs_search_modal" data-toggle="modal" data-target="#mkdocs_search_modal"><i class="icon-search icon-white"></i> Search</a>
|
||||
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
|
|
@ -79,38 +79,41 @@
|
|||
|
||||
<!-- Main navigation -->
|
||||
<ul class="nav navbar-nav">
|
||||
<li ><a href="/">Home</a></li>
|
||||
|
||||
<li >
|
||||
<a href="../..">Home</a>
|
||||
</li>
|
||||
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Tutorial <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/quickstart">Quickstart</a>
|
||||
<a href="../../tutorial/quickstart/">Quickstart</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/1-serialization">1 - Serialization</a>
|
||||
<a href="../../tutorial/1-serialization/">1 - Serialization</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/2-requests-and-responses">2 - Requests and responses</a>
|
||||
<a href="../../tutorial/2-requests-and-responses/">2 - Requests and responses</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/3-class-based-views">3 - Class based views</a>
|
||||
<a href="../../tutorial/3-class-based-views/">3 - Class based views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/4-authentication-and-permissions">4 - Authentication and permissions</a>
|
||||
<a href="../../tutorial/4-authentication-and-permissions/">4 - Authentication and permissions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/5-relationships-and-hyperlinked-apis">5 - Relationships and hyperlinked APIs</a>
|
||||
<a href="../../tutorial/5-relationships-and-hyperlinked-apis/">5 - Relationships and hyperlinked APIs</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/6-viewsets-and-routers">6 - Viewsets and routers</a>
|
||||
<a href="../../tutorial/6-viewsets-and-routers/">6 - Viewsets and routers</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -121,107 +124,107 @@
|
|||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../requests">Requests</a>
|
||||
<a href="../requests/">Requests</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../responses">Responses</a>
|
||||
<a href="../responses/">Responses</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../views">Views</a>
|
||||
<a href="../views/">Views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../generic-views">Generic views</a>
|
||||
<a href="../generic-views/">Generic views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../viewsets">Viewsets</a>
|
||||
<a href="../viewsets/">Viewsets</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../routers">Routers</a>
|
||||
<a href="../routers/">Routers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../parsers">Parsers</a>
|
||||
<a href="../parsers/">Parsers</a>
|
||||
</li>
|
||||
|
||||
<li class="active" >
|
||||
<a href=".">Renderers</a>
|
||||
<a href="./">Renderers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../serializers">Serializers</a>
|
||||
<a href="../serializers/">Serializers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../fields">Serializer fields</a>
|
||||
<a href="../fields/">Serializer fields</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../relations">Serializer relations</a>
|
||||
<a href="../relations/">Serializer relations</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../validators">Validators</a>
|
||||
<a href="../validators/">Validators</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../authentication">Authentication</a>
|
||||
<a href="../authentication/">Authentication</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../permissions">Permissions</a>
|
||||
<a href="../permissions/">Permissions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../throttling">Throttling</a>
|
||||
<a href="../throttling/">Throttling</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../filtering">Filtering</a>
|
||||
<a href="../filtering/">Filtering</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../pagination">Pagination</a>
|
||||
<a href="../pagination/">Pagination</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../versioning">Versioning</a>
|
||||
<a href="../versioning/">Versioning</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../content-negotiation">Content negotiation</a>
|
||||
<a href="../content-negotiation/">Content negotiation</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../metadata">Metadata</a>
|
||||
<a href="../metadata/">Metadata</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../format-suffixes">Format suffixes</a>
|
||||
<a href="../format-suffixes/">Format suffixes</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../reverse">Returning URLs</a>
|
||||
<a href="../reverse/">Returning URLs</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../exceptions">Exceptions</a>
|
||||
<a href="../exceptions/">Exceptions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../status-codes">Status codes</a>
|
||||
<a href="../status-codes/">Status codes</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../testing">Testing</a>
|
||||
<a href="../testing/">Testing</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../settings">Settings</a>
|
||||
<a href="../settings/">Settings</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -232,55 +235,55 @@
|
|||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../../topics/documenting-your-api">Documenting your API</a>
|
||||
<a href="../../topics/documenting-your-api/">Documenting your API</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/internationalization">Internationalization</a>
|
||||
<a href="../../topics/internationalization/">Internationalization</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/ajax-csrf-cors">AJAX, CSRF & CORS</a>
|
||||
<a href="../../topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/browser-enhancements">Browser enhancements</a>
|
||||
<a href="../../topics/browser-enhancements/">Browser Enhancements</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/browsable-api">The Browsable API</a>
|
||||
<a href="../../topics/browsable-api/">The Browsable API</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/rest-hypermedia-hateoas">REST, Hypermedia & HATEOAS</a>
|
||||
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/third-party-resources">Third Party Resources</a>
|
||||
<a href="../../topics/third-party-resources/">Third Party Resources</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/contributing">Contributing to REST framework</a>
|
||||
<a href="../../topics/contributing/">Contributing to REST framework</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/project-management">Project management</a>
|
||||
<a href="../../topics/project-management/">Project management</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/3.0-announcement">3.0 Announcement</a>
|
||||
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/3.1-announcement">3.1 Announcement</a>
|
||||
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/kickstarter-announcement">Kickstarter Announcement</a>
|
||||
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/release-notes">Release Notes</a>
|
||||
<a href="../../topics/release-notes/">Release Notes</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -300,27 +303,19 @@
|
|||
<div class="container-fluid">
|
||||
|
||||
<!-- Search Modal -->
|
||||
<div id="searchModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div id="mkdocs_search_modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3 id="myModalLabel">Documentation search</h3>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<!-- Custom google search -->
|
||||
<script>
|
||||
(function() {
|
||||
var cx = '015016005043623903336:rxraeohqk6w';
|
||||
var gcse = document.createElement('script');
|
||||
gcse.type = 'text/javascript';
|
||||
gcse.async = true;
|
||||
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
|
||||
'//www.google.com/cse/cse.js?cx=' + cx;
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(gcse, s);
|
||||
})();
|
||||
</script>
|
||||
<gcse:search></gcse:search>
|
||||
<form role="form">
|
||||
<div class="form-group">
|
||||
<input type="text" name="q" class="form-control" placeholder="Search..." id="mkdocs-search-query">
|
||||
</div>
|
||||
</form>
|
||||
<div id="mkdocs-search-results"></div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
|
|
@ -496,15 +491,18 @@
|
|||
</div>
|
||||
|
||||
<div id="main-content" class="span9">
|
||||
|
||||
|
||||
<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/renderers.py">
|
||||
<span class="label label-info">renderers.py</span>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<h1 id="renderers">Renderers</h1>
|
||||
|
||||
|
||||
<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/renderers.py">
|
||||
<span class="label label-info">renderers.py</span>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<h1 id="renderers">Renderers</h1>
|
||||
<blockquote>
|
||||
<p>Before a TemplateResponse instance can be returned to the client, it must be rendered. The rendering process takes the intermediate representation of template and context, and turns it into the final byte stream that can be served to the client.</p>
|
||||
<p>— <a href="https://docs.djangoproject.com/en/dev/ref/template-response/#the-rendering-process">Django documentation</a></p>
|
||||
|
|
@ -513,7 +511,7 @@
|
|||
<h2 id="how-the-renderer-is-determined">How the renderer is determined</h2>
|
||||
<p>The set of valid renderers for a view is always defined as a list of classes. When a view is entered REST framework will perform content negotiation on the incoming request, and determine the most appropriate renderer to satisfy the request.</p>
|
||||
<p>The basic process of content negotiation involves examining the request's <code>Accept</code> header, to determine which media types it expects in the response. Optionally, format suffixes on the URL may be used to explicitly request a particular representation. For example the URL <code>http://example.com/api/users_count.json</code> might be an endpoint that always returns JSON data.</p>
|
||||
<p>For more information see the documentation on <a href="../content-negotiation">content negotiation</a>.</p>
|
||||
<p>For more information see the documentation on <a href="../content-negotiation/">content negotiation</a>.</p>
|
||||
<h2 id="setting-the-renderers">Setting the renderers</h2>
|
||||
<p>The default set of renderers may be set globally, using the <code>DEFAULT_RENDERER_CLASSES</code> setting. For example, the following settings would use <code>JSON</code> as the main media type and also include the self describing API.</p>
|
||||
<pre><code>REST_FRAMEWORK = {
|
||||
|
|
@ -635,7 +633,7 @@ def simple_html_view(request):
|
|||
return JSONRenderer()
|
||||
</code></pre>
|
||||
<h2 id="multipartrenderer">MultiPartRenderer</h2>
|
||||
<p>This renderer is used for rendering HTML multipart form data. <strong>It is not suitable as a response renderer</strong>, but is instead used for creating test requests, using REST framework's <a href="../testing">test client and test request factory</a>.</p>
|
||||
<p>This renderer is used for rendering HTML multipart form data. <strong>It is not suitable as a response renderer</strong>, but is instead used for creating test requests, using REST framework's <a href="../testing/">test client and test request factory</a>.</p>
|
||||
<p><strong>.media_type</strong>: <code>multipart/form-data; boundary=BoUnDaRyStRiNg</code></p>
|
||||
<p><strong>.format</strong>: <code>'.multipart'</code></p>
|
||||
<p><strong>.charset</strong>: <code>utf-8</code></p>
|
||||
|
|
@ -804,6 +802,8 @@ In this case you can underspecify the media types it should respond to, by using
|
|||
<h2 id="pandas-csv-excel-png">Pandas (CSV, Excel, PNG)</h2>
|
||||
<p><a href="https://github.com/wq/django-rest-pandas">Django REST Pandas</a> provides a serializer and renderers that support additional data processing and output via the <a href="http://pandas.pydata.org/">Pandas</a> DataFrame API. Django REST Pandas includes renderers for Pandas-style CSV files, Excel workbooks (both <code>.xls</code> and <code>.xlsx</code>), and a number of <a href="https://github.com/wq/django-rest-pandas#supported-formats">other formats</a>. It is maintained by <a href="https://github.com/sheppard">S. Andrew Sheppard</a> as part of the <a href="https://github.com/wq">wq Project</a>.</p>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!--/span-->
|
||||
</div>
|
||||
|
|
@ -827,6 +827,8 @@ In this case you can underspecify the media types it should respond to, by using
|
|||
<script src="../../js/jquery-1.8.1-min.js"></script>
|
||||
<script src="../../js/prettify-1.0.js"></script>
|
||||
<script src="../../js/bootstrap-2.1.1-min.js"></script>
|
||||
<script>var base_url = '../..';</script>
|
||||
<script src="../../mkdocs/js/require.js"></script>
|
||||
<script src="../../js/theme.js"></script>
|
||||
|
||||
<script>
|
||||
|
|
|
|||
|
|
@ -62,13 +62,13 @@
|
|||
<div class="navbar-inner">
|
||||
<div class="container-fluid">
|
||||
<a class="repo-link btn btn-primary btn-small" href="https://github.com/tomchristie/django-rest-framework/tree/master">GitHub</a>
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../responses">
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../responses/">
|
||||
Next <i class="icon-arrow-right icon-white"></i>
|
||||
</a>
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../../tutorial/6-viewsets-and-routers">
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../../tutorial/6-viewsets-and-routers/">
|
||||
<i class="icon-arrow-left icon-white"></i> Previous
|
||||
</a>
|
||||
<a class="repo-link btn btn-inverse btn-small" href="#searchModal" data-toggle="modal"><i class="icon-search icon-white"></i> Search</a>
|
||||
<a id="search_modal_show" class="repo-link btn btn-inverse btn-small" href="#mkdocs_search_modal" data-toggle="modal" data-target="#mkdocs_search_modal"><i class="icon-search icon-white"></i> Search</a>
|
||||
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
|
|
@ -79,38 +79,41 @@
|
|||
|
||||
<!-- Main navigation -->
|
||||
<ul class="nav navbar-nav">
|
||||
<li ><a href="/">Home</a></li>
|
||||
|
||||
<li >
|
||||
<a href="../..">Home</a>
|
||||
</li>
|
||||
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Tutorial <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/quickstart">Quickstart</a>
|
||||
<a href="../../tutorial/quickstart/">Quickstart</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/1-serialization">1 - Serialization</a>
|
||||
<a href="../../tutorial/1-serialization/">1 - Serialization</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/2-requests-and-responses">2 - Requests and responses</a>
|
||||
<a href="../../tutorial/2-requests-and-responses/">2 - Requests and responses</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/3-class-based-views">3 - Class based views</a>
|
||||
<a href="../../tutorial/3-class-based-views/">3 - Class based views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/4-authentication-and-permissions">4 - Authentication and permissions</a>
|
||||
<a href="../../tutorial/4-authentication-and-permissions/">4 - Authentication and permissions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/5-relationships-and-hyperlinked-apis">5 - Relationships and hyperlinked APIs</a>
|
||||
<a href="../../tutorial/5-relationships-and-hyperlinked-apis/">5 - Relationships and hyperlinked APIs</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/6-viewsets-and-routers">6 - Viewsets and routers</a>
|
||||
<a href="../../tutorial/6-viewsets-and-routers/">6 - Viewsets and routers</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -121,107 +124,107 @@
|
|||
<ul class="dropdown-menu">
|
||||
|
||||
<li class="active" >
|
||||
<a href=".">Requests</a>
|
||||
<a href="./">Requests</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../responses">Responses</a>
|
||||
<a href="../responses/">Responses</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../views">Views</a>
|
||||
<a href="../views/">Views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../generic-views">Generic views</a>
|
||||
<a href="../generic-views/">Generic views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../viewsets">Viewsets</a>
|
||||
<a href="../viewsets/">Viewsets</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../routers">Routers</a>
|
||||
<a href="../routers/">Routers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../parsers">Parsers</a>
|
||||
<a href="../parsers/">Parsers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../renderers">Renderers</a>
|
||||
<a href="../renderers/">Renderers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../serializers">Serializers</a>
|
||||
<a href="../serializers/">Serializers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../fields">Serializer fields</a>
|
||||
<a href="../fields/">Serializer fields</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../relations">Serializer relations</a>
|
||||
<a href="../relations/">Serializer relations</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../validators">Validators</a>
|
||||
<a href="../validators/">Validators</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../authentication">Authentication</a>
|
||||
<a href="../authentication/">Authentication</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../permissions">Permissions</a>
|
||||
<a href="../permissions/">Permissions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../throttling">Throttling</a>
|
||||
<a href="../throttling/">Throttling</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../filtering">Filtering</a>
|
||||
<a href="../filtering/">Filtering</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../pagination">Pagination</a>
|
||||
<a href="../pagination/">Pagination</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../versioning">Versioning</a>
|
||||
<a href="../versioning/">Versioning</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../content-negotiation">Content negotiation</a>
|
||||
<a href="../content-negotiation/">Content negotiation</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../metadata">Metadata</a>
|
||||
<a href="../metadata/">Metadata</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../format-suffixes">Format suffixes</a>
|
||||
<a href="../format-suffixes/">Format suffixes</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../reverse">Returning URLs</a>
|
||||
<a href="../reverse/">Returning URLs</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../exceptions">Exceptions</a>
|
||||
<a href="../exceptions/">Exceptions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../status-codes">Status codes</a>
|
||||
<a href="../status-codes/">Status codes</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../testing">Testing</a>
|
||||
<a href="../testing/">Testing</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../settings">Settings</a>
|
||||
<a href="../settings/">Settings</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -232,55 +235,55 @@
|
|||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../../topics/documenting-your-api">Documenting your API</a>
|
||||
<a href="../../topics/documenting-your-api/">Documenting your API</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/internationalization">Internationalization</a>
|
||||
<a href="../../topics/internationalization/">Internationalization</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/ajax-csrf-cors">AJAX, CSRF & CORS</a>
|
||||
<a href="../../topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/browser-enhancements">Browser enhancements</a>
|
||||
<a href="../../topics/browser-enhancements/">Browser Enhancements</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/browsable-api">The Browsable API</a>
|
||||
<a href="../../topics/browsable-api/">The Browsable API</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/rest-hypermedia-hateoas">REST, Hypermedia & HATEOAS</a>
|
||||
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/third-party-resources">Third Party Resources</a>
|
||||
<a href="../../topics/third-party-resources/">Third Party Resources</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/contributing">Contributing to REST framework</a>
|
||||
<a href="../../topics/contributing/">Contributing to REST framework</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/project-management">Project management</a>
|
||||
<a href="../../topics/project-management/">Project management</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/3.0-announcement">3.0 Announcement</a>
|
||||
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/3.1-announcement">3.1 Announcement</a>
|
||||
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/kickstarter-announcement">Kickstarter Announcement</a>
|
||||
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/release-notes">Release Notes</a>
|
||||
<a href="../../topics/release-notes/">Release Notes</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -300,27 +303,19 @@
|
|||
<div class="container-fluid">
|
||||
|
||||
<!-- Search Modal -->
|
||||
<div id="searchModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div id="mkdocs_search_modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3 id="myModalLabel">Documentation search</h3>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<!-- Custom google search -->
|
||||
<script>
|
||||
(function() {
|
||||
var cx = '015016005043623903336:rxraeohqk6w';
|
||||
var gcse = document.createElement('script');
|
||||
gcse.type = 'text/javascript';
|
||||
gcse.async = true;
|
||||
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
|
||||
'//www.google.com/cse/cse.js?cx=' + cx;
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(gcse, s);
|
||||
})();
|
||||
</script>
|
||||
<gcse:search></gcse:search>
|
||||
<form role="form">
|
||||
<div class="form-group">
|
||||
<input type="text" name="q" class="form-control" placeholder="Search..." id="mkdocs-search-query">
|
||||
</div>
|
||||
</form>
|
||||
<div id="mkdocs-search-results"></div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
|
|
@ -452,15 +447,18 @@
|
|||
</div>
|
||||
|
||||
<div id="main-content" class="span9">
|
||||
|
||||
|
||||
<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/request.py">
|
||||
<span class="label label-info">request.py</span>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<h1 id="requests">Requests</h1>
|
||||
|
||||
|
||||
<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/request.py">
|
||||
<span class="label label-info">request.py</span>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<h1 id="requests">Requests</h1>
|
||||
<blockquote>
|
||||
<p>If you're doing REST-based web service stuff ... you should ignore request.POST.</p>
|
||||
<p>— Malcom Tredinnick, <a href="https://groups.google.com/d/topic/django-developers/dxI4qVzrBY4/discussion">Django developers group</a></p>
|
||||
|
|
@ -476,7 +474,7 @@
|
|||
<li>It supports parsing the content of HTTP methods other than <code>POST</code>, meaning that you can access the content of <code>PUT</code> and <code>PATCH</code> requests.</li>
|
||||
<li>It supports REST framework's flexible request parsing, rather than just supporting form data. For example you can handle incoming JSON data in the same way that you handle incoming form data.</li>
|
||||
</ul>
|
||||
<p>For more details see the <a href="../parsers">parsers documentation</a>.</p>
|
||||
<p>For more details see the <a href="../parsers/">parsers documentation</a>.</p>
|
||||
<h2 id="query_params">.query_params</h2>
|
||||
<p><code>request.query_params</code> is a more correctly named synonym for <code>request.GET</code>.</p>
|
||||
<p>For clarity inside your code, we recommend using <code>request.query_params</code> instead of the Django's standard <code>request.GET</code>. Doing so will help keep your codebase more correct and obvious - any HTTP method type may include query parameters, not just <code>GET</code> requests.</p>
|
||||
|
|
@ -508,11 +506,11 @@
|
|||
<h2 id="user">.user</h2>
|
||||
<p><code>request.user</code> typically returns an instance of <code>django.contrib.auth.models.User</code>, although the behavior depends on the authentication policy being used.</p>
|
||||
<p>If the request is unauthenticated the default value of <code>request.user</code> is an instance of <code>django.contrib.auth.models.AnonymousUser</code>.</p>
|
||||
<p>For more details see the <a href="../authentication">authentication documentation</a>.</p>
|
||||
<p>For more details see the <a href="../authentication/">authentication documentation</a>.</p>
|
||||
<h2 id="auth">.auth</h2>
|
||||
<p><code>request.auth</code> returns any additional authentication context. The exact behavior of <code>request.auth</code> depends on the authentication policy being used, but it may typically be an instance of the token that the request was authenticated against.</p>
|
||||
<p>If the request is unauthenticated, or if no additional context is present, the default value of <code>request.auth</code> is <code>None</code>.</p>
|
||||
<p>For more details see the <a href="../authentication">authentication documentation</a>.</p>
|
||||
<p>For more details see the <a href="../authentication/">authentication documentation</a>.</p>
|
||||
<h2 id="authenticators">.authenticators</h2>
|
||||
<p>The <code>APIView</code> class or <code>@api_view</code> decorator will ensure that this property is automatically set to a list of <code>Authentication</code> instances, based on the <code>authentication_classes</code> set on the view or based on the <code>DEFAULT_AUTHENTICATORS</code> setting.</p>
|
||||
<p>You won't typically need to access this property.</p>
|
||||
|
|
@ -522,22 +520,24 @@
|
|||
<h2 id="method">.method</h2>
|
||||
<p><code>request.method</code> returns the <strong>uppercased</strong> string representation of the request's HTTP method.</p>
|
||||
<p>Browser-based <code>PUT</code>, <code>PATCH</code> and <code>DELETE</code> forms are transparently supported.</p>
|
||||
<p>For more information see the <a href="../../topics/browser-enhancements">browser enhancements documentation</a>.</p>
|
||||
<p>For more information see the <a href="../../topics/browser-enhancements/">browser enhancements documentation</a>.</p>
|
||||
<h2 id="content_type">.content_type</h2>
|
||||
<p><code>request.content_type</code>, returns a string object representing the media type of the HTTP request's body, or an empty string if no media type was provided.</p>
|
||||
<p>You won't typically need to directly access the request's content type, as you'll normally rely on REST framework's default request parsing behavior.</p>
|
||||
<p>If you do need to access the content type of the request you should use the <code>.content_type</code> property in preference to using <code>request.META.get('HTTP_CONTENT_TYPE')</code>, as it provides transparent support for browser-based non-form content.</p>
|
||||
<p>For more information see the <a href="../../topics/browser-enhancements">browser enhancements documentation</a>.</p>
|
||||
<p>For more information see the <a href="../../topics/browser-enhancements/">browser enhancements documentation</a>.</p>
|
||||
<h2 id="stream">.stream</h2>
|
||||
<p><code>request.stream</code> returns a stream representing the content of the request body.</p>
|
||||
<p>You won't typically need to directly access the request's content, as you'll normally rely on REST framework's default request parsing behavior.</p>
|
||||
<p>If you do need to access the raw content directly, you should use the <code>.stream</code> property in preference to using <code>request.content</code>, as it provides transparent support for browser-based non-form content.</p>
|
||||
<p>For more information see the <a href="../../topics/browser-enhancements">browser enhancements documentation</a>.</p>
|
||||
<p>For more information see the <a href="../../topics/browser-enhancements/">browser enhancements documentation</a>.</p>
|
||||
<hr />
|
||||
<h1 id="standard-httprequest-attributes">Standard HttpRequest attributes</h1>
|
||||
<p>As REST framework's <code>Request</code> extends Django's <code>HttpRequest</code>, all the other standard attributes and methods are also available. For example the <code>request.META</code> and <code>request.session</code> dictionaries are available as normal.</p>
|
||||
<p>Note that due to implementation reasons the <code>Request</code> class does not inherit from <code>HttpRequest</code> class, but instead extends the class using composition.</p>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!--/span-->
|
||||
</div>
|
||||
|
|
@ -561,6 +561,8 @@
|
|||
<script src="../../js/jquery-1.8.1-min.js"></script>
|
||||
<script src="../../js/prettify-1.0.js"></script>
|
||||
<script src="../../js/bootstrap-2.1.1-min.js"></script>
|
||||
<script>var base_url = '../..';</script>
|
||||
<script src="../../mkdocs/js/require.js"></script>
|
||||
<script src="../../js/theme.js"></script>
|
||||
|
||||
<script>
|
||||
|
|
|
|||
|
|
@ -62,13 +62,13 @@
|
|||
<div class="navbar-inner">
|
||||
<div class="container-fluid">
|
||||
<a class="repo-link btn btn-primary btn-small" href="https://github.com/tomchristie/django-rest-framework/tree/master">GitHub</a>
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../views">
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../views/">
|
||||
Next <i class="icon-arrow-right icon-white"></i>
|
||||
</a>
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../requests">
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../requests/">
|
||||
<i class="icon-arrow-left icon-white"></i> Previous
|
||||
</a>
|
||||
<a class="repo-link btn btn-inverse btn-small" href="#searchModal" data-toggle="modal"><i class="icon-search icon-white"></i> Search</a>
|
||||
<a id="search_modal_show" class="repo-link btn btn-inverse btn-small" href="#mkdocs_search_modal" data-toggle="modal" data-target="#mkdocs_search_modal"><i class="icon-search icon-white"></i> Search</a>
|
||||
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
|
|
@ -79,38 +79,41 @@
|
|||
|
||||
<!-- Main navigation -->
|
||||
<ul class="nav navbar-nav">
|
||||
<li ><a href="/">Home</a></li>
|
||||
|
||||
<li >
|
||||
<a href="../..">Home</a>
|
||||
</li>
|
||||
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Tutorial <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/quickstart">Quickstart</a>
|
||||
<a href="../../tutorial/quickstart/">Quickstart</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/1-serialization">1 - Serialization</a>
|
||||
<a href="../../tutorial/1-serialization/">1 - Serialization</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/2-requests-and-responses">2 - Requests and responses</a>
|
||||
<a href="../../tutorial/2-requests-and-responses/">2 - Requests and responses</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/3-class-based-views">3 - Class based views</a>
|
||||
<a href="../../tutorial/3-class-based-views/">3 - Class based views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/4-authentication-and-permissions">4 - Authentication and permissions</a>
|
||||
<a href="../../tutorial/4-authentication-and-permissions/">4 - Authentication and permissions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/5-relationships-and-hyperlinked-apis">5 - Relationships and hyperlinked APIs</a>
|
||||
<a href="../../tutorial/5-relationships-and-hyperlinked-apis/">5 - Relationships and hyperlinked APIs</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/6-viewsets-and-routers">6 - Viewsets and routers</a>
|
||||
<a href="../../tutorial/6-viewsets-and-routers/">6 - Viewsets and routers</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -121,107 +124,107 @@
|
|||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../requests">Requests</a>
|
||||
<a href="../requests/">Requests</a>
|
||||
</li>
|
||||
|
||||
<li class="active" >
|
||||
<a href=".">Responses</a>
|
||||
<a href="./">Responses</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../views">Views</a>
|
||||
<a href="../views/">Views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../generic-views">Generic views</a>
|
||||
<a href="../generic-views/">Generic views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../viewsets">Viewsets</a>
|
||||
<a href="../viewsets/">Viewsets</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../routers">Routers</a>
|
||||
<a href="../routers/">Routers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../parsers">Parsers</a>
|
||||
<a href="../parsers/">Parsers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../renderers">Renderers</a>
|
||||
<a href="../renderers/">Renderers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../serializers">Serializers</a>
|
||||
<a href="../serializers/">Serializers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../fields">Serializer fields</a>
|
||||
<a href="../fields/">Serializer fields</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../relations">Serializer relations</a>
|
||||
<a href="../relations/">Serializer relations</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../validators">Validators</a>
|
||||
<a href="../validators/">Validators</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../authentication">Authentication</a>
|
||||
<a href="../authentication/">Authentication</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../permissions">Permissions</a>
|
||||
<a href="../permissions/">Permissions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../throttling">Throttling</a>
|
||||
<a href="../throttling/">Throttling</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../filtering">Filtering</a>
|
||||
<a href="../filtering/">Filtering</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../pagination">Pagination</a>
|
||||
<a href="../pagination/">Pagination</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../versioning">Versioning</a>
|
||||
<a href="../versioning/">Versioning</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../content-negotiation">Content negotiation</a>
|
||||
<a href="../content-negotiation/">Content negotiation</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../metadata">Metadata</a>
|
||||
<a href="../metadata/">Metadata</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../format-suffixes">Format suffixes</a>
|
||||
<a href="../format-suffixes/">Format suffixes</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../reverse">Returning URLs</a>
|
||||
<a href="../reverse/">Returning URLs</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../exceptions">Exceptions</a>
|
||||
<a href="../exceptions/">Exceptions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../status-codes">Status codes</a>
|
||||
<a href="../status-codes/">Status codes</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../testing">Testing</a>
|
||||
<a href="../testing/">Testing</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../settings">Settings</a>
|
||||
<a href="../settings/">Settings</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -232,55 +235,55 @@
|
|||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../../topics/documenting-your-api">Documenting your API</a>
|
||||
<a href="../../topics/documenting-your-api/">Documenting your API</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/internationalization">Internationalization</a>
|
||||
<a href="../../topics/internationalization/">Internationalization</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/ajax-csrf-cors">AJAX, CSRF & CORS</a>
|
||||
<a href="../../topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/browser-enhancements">Browser enhancements</a>
|
||||
<a href="../../topics/browser-enhancements/">Browser Enhancements</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/browsable-api">The Browsable API</a>
|
||||
<a href="../../topics/browsable-api/">The Browsable API</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/rest-hypermedia-hateoas">REST, Hypermedia & HATEOAS</a>
|
||||
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/third-party-resources">Third Party Resources</a>
|
||||
<a href="../../topics/third-party-resources/">Third Party Resources</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/contributing">Contributing to REST framework</a>
|
||||
<a href="../../topics/contributing/">Contributing to REST framework</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/project-management">Project management</a>
|
||||
<a href="../../topics/project-management/">Project management</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/3.0-announcement">3.0 Announcement</a>
|
||||
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/3.1-announcement">3.1 Announcement</a>
|
||||
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/kickstarter-announcement">Kickstarter Announcement</a>
|
||||
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/release-notes">Release Notes</a>
|
||||
<a href="../../topics/release-notes/">Release Notes</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -300,27 +303,19 @@
|
|||
<div class="container-fluid">
|
||||
|
||||
<!-- Search Modal -->
|
||||
<div id="searchModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div id="mkdocs_search_modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3 id="myModalLabel">Documentation search</h3>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<!-- Custom google search -->
|
||||
<script>
|
||||
(function() {
|
||||
var cx = '015016005043623903336:rxraeohqk6w';
|
||||
var gcse = document.createElement('script');
|
||||
gcse.type = 'text/javascript';
|
||||
gcse.async = true;
|
||||
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
|
||||
'//www.google.com/cse/cse.js?cx=' + cx;
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(gcse, s);
|
||||
})();
|
||||
</script>
|
||||
<gcse:search></gcse:search>
|
||||
<form role="form">
|
||||
<div class="form-group">
|
||||
<input type="text" name="q" class="form-control" placeholder="Search..." id="mkdocs-search-query">
|
||||
</div>
|
||||
</form>
|
||||
<div id="mkdocs-search-results"></div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
|
|
@ -420,15 +415,18 @@
|
|||
</div>
|
||||
|
||||
<div id="main-content" class="span9">
|
||||
|
||||
|
||||
<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/response.py">
|
||||
<span class="label label-info">response.py</span>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<h1 id="responses">Responses</h1>
|
||||
|
||||
|
||||
<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/response.py">
|
||||
<span class="label label-info">response.py</span>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<h1 id="responses">Responses</h1>
|
||||
<blockquote>
|
||||
<p>Unlike basic HttpResponse objects, TemplateResponse objects retain the details of the context that was provided by the view to compute the response. The final output of the response is not computed until it is needed, later in the response process.</p>
|
||||
<p>— <a href="https://docs.djangoproject.com/en/dev/ref/template-response/">Django documentation</a></p>
|
||||
|
|
@ -447,7 +445,7 @@
|
|||
<p>Arguments:</p>
|
||||
<ul>
|
||||
<li><code>data</code>: The serialized data for the response.</li>
|
||||
<li><code>status</code>: A status code for the response. Defaults to 200. See also <a href="../status-codes">status codes</a>.</li>
|
||||
<li><code>status</code>: A status code for the response. Defaults to 200. See also <a href="../status-codes/">status codes</a>.</li>
|
||||
<li><code>template_name</code>: A template name to use if <code>HTMLRenderer</code> is selected.</li>
|
||||
<li><code>headers</code>: A dictionary of HTTP headers to use in the response.</li>
|
||||
<li><code>content_type</code>: The content type of the response. Typically, this will be set automatically by the renderer as determined by content negotiation, but there may be some cases where you need to specify the content type explicitly.</li>
|
||||
|
|
@ -482,6 +480,8 @@ response['Cache-Control'] = 'no-cache'
|
|||
<p>As with any other <code>TemplateResponse</code>, this method is called to render the serialized data of the response into the final response content. When <code>.render()</code> is called, the response content will be set to the result of calling the <code>.render(data, accepted_media_type, renderer_context)</code> method on the <code>accepted_renderer</code> instance.</p>
|
||||
<p>You won't typically need to call <code>.render()</code> yourself, as it's handled by Django's standard response cycle.</p>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!--/span-->
|
||||
</div>
|
||||
|
|
@ -505,6 +505,8 @@ response['Cache-Control'] = 'no-cache'
|
|||
<script src="../../js/jquery-1.8.1-min.js"></script>
|
||||
<script src="../../js/prettify-1.0.js"></script>
|
||||
<script src="../../js/bootstrap-2.1.1-min.js"></script>
|
||||
<script>var base_url = '../..';</script>
|
||||
<script src="../../mkdocs/js/require.js"></script>
|
||||
<script src="../../js/theme.js"></script>
|
||||
|
||||
<script>
|
||||
|
|
|
|||
|
|
@ -62,13 +62,13 @@
|
|||
<div class="navbar-inner">
|
||||
<div class="container-fluid">
|
||||
<a class="repo-link btn btn-primary btn-small" href="https://github.com/tomchristie/django-rest-framework/tree/master">GitHub</a>
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../exceptions">
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../exceptions/">
|
||||
Next <i class="icon-arrow-right icon-white"></i>
|
||||
</a>
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../format-suffixes">
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../format-suffixes/">
|
||||
<i class="icon-arrow-left icon-white"></i> Previous
|
||||
</a>
|
||||
<a class="repo-link btn btn-inverse btn-small" href="#searchModal" data-toggle="modal"><i class="icon-search icon-white"></i> Search</a>
|
||||
<a id="search_modal_show" class="repo-link btn btn-inverse btn-small" href="#mkdocs_search_modal" data-toggle="modal" data-target="#mkdocs_search_modal"><i class="icon-search icon-white"></i> Search</a>
|
||||
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
|
|
@ -79,38 +79,41 @@
|
|||
|
||||
<!-- Main navigation -->
|
||||
<ul class="nav navbar-nav">
|
||||
<li ><a href="/">Home</a></li>
|
||||
|
||||
<li >
|
||||
<a href="../..">Home</a>
|
||||
</li>
|
||||
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Tutorial <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/quickstart">Quickstart</a>
|
||||
<a href="../../tutorial/quickstart/">Quickstart</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/1-serialization">1 - Serialization</a>
|
||||
<a href="../../tutorial/1-serialization/">1 - Serialization</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/2-requests-and-responses">2 - Requests and responses</a>
|
||||
<a href="../../tutorial/2-requests-and-responses/">2 - Requests and responses</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/3-class-based-views">3 - Class based views</a>
|
||||
<a href="../../tutorial/3-class-based-views/">3 - Class based views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/4-authentication-and-permissions">4 - Authentication and permissions</a>
|
||||
<a href="../../tutorial/4-authentication-and-permissions/">4 - Authentication and permissions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/5-relationships-and-hyperlinked-apis">5 - Relationships and hyperlinked APIs</a>
|
||||
<a href="../../tutorial/5-relationships-and-hyperlinked-apis/">5 - Relationships and hyperlinked APIs</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/6-viewsets-and-routers">6 - Viewsets and routers</a>
|
||||
<a href="../../tutorial/6-viewsets-and-routers/">6 - Viewsets and routers</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -121,107 +124,107 @@
|
|||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../requests">Requests</a>
|
||||
<a href="../requests/">Requests</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../responses">Responses</a>
|
||||
<a href="../responses/">Responses</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../views">Views</a>
|
||||
<a href="../views/">Views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../generic-views">Generic views</a>
|
||||
<a href="../generic-views/">Generic views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../viewsets">Viewsets</a>
|
||||
<a href="../viewsets/">Viewsets</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../routers">Routers</a>
|
||||
<a href="../routers/">Routers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../parsers">Parsers</a>
|
||||
<a href="../parsers/">Parsers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../renderers">Renderers</a>
|
||||
<a href="../renderers/">Renderers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../serializers">Serializers</a>
|
||||
<a href="../serializers/">Serializers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../fields">Serializer fields</a>
|
||||
<a href="../fields/">Serializer fields</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../relations">Serializer relations</a>
|
||||
<a href="../relations/">Serializer relations</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../validators">Validators</a>
|
||||
<a href="../validators/">Validators</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../authentication">Authentication</a>
|
||||
<a href="../authentication/">Authentication</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../permissions">Permissions</a>
|
||||
<a href="../permissions/">Permissions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../throttling">Throttling</a>
|
||||
<a href="../throttling/">Throttling</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../filtering">Filtering</a>
|
||||
<a href="../filtering/">Filtering</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../pagination">Pagination</a>
|
||||
<a href="../pagination/">Pagination</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../versioning">Versioning</a>
|
||||
<a href="../versioning/">Versioning</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../content-negotiation">Content negotiation</a>
|
||||
<a href="../content-negotiation/">Content negotiation</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../metadata">Metadata</a>
|
||||
<a href="../metadata/">Metadata</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../format-suffixes">Format suffixes</a>
|
||||
<a href="../format-suffixes/">Format suffixes</a>
|
||||
</li>
|
||||
|
||||
<li class="active" >
|
||||
<a href=".">Returning URLs</a>
|
||||
<a href="./">Returning URLs</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../exceptions">Exceptions</a>
|
||||
<a href="../exceptions/">Exceptions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../status-codes">Status codes</a>
|
||||
<a href="../status-codes/">Status codes</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../testing">Testing</a>
|
||||
<a href="../testing/">Testing</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../settings">Settings</a>
|
||||
<a href="../settings/">Settings</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -232,55 +235,55 @@
|
|||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../../topics/documenting-your-api">Documenting your API</a>
|
||||
<a href="../../topics/documenting-your-api/">Documenting your API</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/internationalization">Internationalization</a>
|
||||
<a href="../../topics/internationalization/">Internationalization</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/ajax-csrf-cors">AJAX, CSRF & CORS</a>
|
||||
<a href="../../topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/browser-enhancements">Browser enhancements</a>
|
||||
<a href="../../topics/browser-enhancements/">Browser Enhancements</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/browsable-api">The Browsable API</a>
|
||||
<a href="../../topics/browsable-api/">The Browsable API</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/rest-hypermedia-hateoas">REST, Hypermedia & HATEOAS</a>
|
||||
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/third-party-resources">Third Party Resources</a>
|
||||
<a href="../../topics/third-party-resources/">Third Party Resources</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/contributing">Contributing to REST framework</a>
|
||||
<a href="../../topics/contributing/">Contributing to REST framework</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/project-management">Project management</a>
|
||||
<a href="../../topics/project-management/">Project management</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/3.0-announcement">3.0 Announcement</a>
|
||||
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/3.1-announcement">3.1 Announcement</a>
|
||||
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/kickstarter-announcement">Kickstarter Announcement</a>
|
||||
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/release-notes">Release Notes</a>
|
||||
<a href="../../topics/release-notes/">Release Notes</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -300,27 +303,19 @@
|
|||
<div class="container-fluid">
|
||||
|
||||
<!-- Search Modal -->
|
||||
<div id="searchModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div id="mkdocs_search_modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3 id="myModalLabel">Documentation search</h3>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<!-- Custom google search -->
|
||||
<script>
|
||||
(function() {
|
||||
var cx = '015016005043623903336:rxraeohqk6w';
|
||||
var gcse = document.createElement('script');
|
||||
gcse.type = 'text/javascript';
|
||||
gcse.async = true;
|
||||
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
|
||||
'//www.google.com/cse/cse.js?cx=' + cx;
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(gcse, s);
|
||||
})();
|
||||
</script>
|
||||
<gcse:search></gcse:search>
|
||||
<form role="form">
|
||||
<div class="form-group">
|
||||
<input type="text" name="q" class="form-control" placeholder="Search..." id="mkdocs-search-query">
|
||||
</div>
|
||||
</form>
|
||||
<div id="mkdocs-search-results"></div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
|
|
@ -368,15 +363,18 @@
|
|||
</div>
|
||||
|
||||
<div id="main-content" class="span9">
|
||||
|
||||
|
||||
<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/reverse.py">
|
||||
<span class="label label-info">reverse.py</span>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<h1 id="returning-urls">Returning URLs</h1>
|
||||
|
||||
|
||||
<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/reverse.py">
|
||||
<span class="label label-info">reverse.py</span>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<h1 id="returning-urls">Returning URLs</h1>
|
||||
<blockquote>
|
||||
<p>The central feature that distinguishes the REST architectural style from other network-based styles is its emphasis on a uniform interface between components.</p>
|
||||
<p>— Roy Fielding, <a href="http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm#sec_5_1_5">Architectural Styles and the Design of Network-based Software Architectures</a></p>
|
||||
|
|
@ -415,6 +413,8 @@ class APIRootView(APIView):
|
|||
<pre><code>api_root = reverse_lazy('api-root', request=request)
|
||||
</code></pre>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!--/span-->
|
||||
</div>
|
||||
|
|
@ -438,6 +438,8 @@ class APIRootView(APIView):
|
|||
<script src="../../js/jquery-1.8.1-min.js"></script>
|
||||
<script src="../../js/prettify-1.0.js"></script>
|
||||
<script src="../../js/bootstrap-2.1.1-min.js"></script>
|
||||
<script>var base_url = '../..';</script>
|
||||
<script src="../../mkdocs/js/require.js"></script>
|
||||
<script src="../../js/theme.js"></script>
|
||||
|
||||
<script>
|
||||
|
|
|
|||
|
|
@ -62,13 +62,13 @@
|
|||
<div class="navbar-inner">
|
||||
<div class="container-fluid">
|
||||
<a class="repo-link btn btn-primary btn-small" href="https://github.com/tomchristie/django-rest-framework/tree/master">GitHub</a>
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../parsers">
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="prev" href="../parsers/">
|
||||
Next <i class="icon-arrow-right icon-white"></i>
|
||||
</a>
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../viewsets">
|
||||
<a class="repo-link btn btn-inverse btn-small " rel="next" href="../viewsets/">
|
||||
<i class="icon-arrow-left icon-white"></i> Previous
|
||||
</a>
|
||||
<a class="repo-link btn btn-inverse btn-small" href="#searchModal" data-toggle="modal"><i class="icon-search icon-white"></i> Search</a>
|
||||
<a id="search_modal_show" class="repo-link btn btn-inverse btn-small" href="#mkdocs_search_modal" data-toggle="modal" data-target="#mkdocs_search_modal"><i class="icon-search icon-white"></i> Search</a>
|
||||
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
|
|
@ -79,38 +79,41 @@
|
|||
|
||||
<!-- Main navigation -->
|
||||
<ul class="nav navbar-nav">
|
||||
<li ><a href="/">Home</a></li>
|
||||
|
||||
<li >
|
||||
<a href="../..">Home</a>
|
||||
</li>
|
||||
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Tutorial <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/quickstart">Quickstart</a>
|
||||
<a href="../../tutorial/quickstart/">Quickstart</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/1-serialization">1 - Serialization</a>
|
||||
<a href="../../tutorial/1-serialization/">1 - Serialization</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/2-requests-and-responses">2 - Requests and responses</a>
|
||||
<a href="../../tutorial/2-requests-and-responses/">2 - Requests and responses</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/3-class-based-views">3 - Class based views</a>
|
||||
<a href="../../tutorial/3-class-based-views/">3 - Class based views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/4-authentication-and-permissions">4 - Authentication and permissions</a>
|
||||
<a href="../../tutorial/4-authentication-and-permissions/">4 - Authentication and permissions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/5-relationships-and-hyperlinked-apis">5 - Relationships and hyperlinked APIs</a>
|
||||
<a href="../../tutorial/5-relationships-and-hyperlinked-apis/">5 - Relationships and hyperlinked APIs</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../tutorial/6-viewsets-and-routers">6 - Viewsets and routers</a>
|
||||
<a href="../../tutorial/6-viewsets-and-routers/">6 - Viewsets and routers</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -121,107 +124,107 @@
|
|||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../requests">Requests</a>
|
||||
<a href="../requests/">Requests</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../responses">Responses</a>
|
||||
<a href="../responses/">Responses</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../views">Views</a>
|
||||
<a href="../views/">Views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../generic-views">Generic views</a>
|
||||
<a href="../generic-views/">Generic views</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../viewsets">Viewsets</a>
|
||||
<a href="../viewsets/">Viewsets</a>
|
||||
</li>
|
||||
|
||||
<li class="active" >
|
||||
<a href=".">Routers</a>
|
||||
<a href="./">Routers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../parsers">Parsers</a>
|
||||
<a href="../parsers/">Parsers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../renderers">Renderers</a>
|
||||
<a href="../renderers/">Renderers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../serializers">Serializers</a>
|
||||
<a href="../serializers/">Serializers</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../fields">Serializer fields</a>
|
||||
<a href="../fields/">Serializer fields</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../relations">Serializer relations</a>
|
||||
<a href="../relations/">Serializer relations</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../validators">Validators</a>
|
||||
<a href="../validators/">Validators</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../authentication">Authentication</a>
|
||||
<a href="../authentication/">Authentication</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../permissions">Permissions</a>
|
||||
<a href="../permissions/">Permissions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../throttling">Throttling</a>
|
||||
<a href="../throttling/">Throttling</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../filtering">Filtering</a>
|
||||
<a href="../filtering/">Filtering</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../pagination">Pagination</a>
|
||||
<a href="../pagination/">Pagination</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../versioning">Versioning</a>
|
||||
<a href="../versioning/">Versioning</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../content-negotiation">Content negotiation</a>
|
||||
<a href="../content-negotiation/">Content negotiation</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../metadata">Metadata</a>
|
||||
<a href="../metadata/">Metadata</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../format-suffixes">Format suffixes</a>
|
||||
<a href="../format-suffixes/">Format suffixes</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../reverse">Returning URLs</a>
|
||||
<a href="../reverse/">Returning URLs</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../exceptions">Exceptions</a>
|
||||
<a href="../exceptions/">Exceptions</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../status-codes">Status codes</a>
|
||||
<a href="../status-codes/">Status codes</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../testing">Testing</a>
|
||||
<a href="../testing/">Testing</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../settings">Settings</a>
|
||||
<a href="../settings/">Settings</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -232,55 +235,55 @@
|
|||
<ul class="dropdown-menu">
|
||||
|
||||
<li >
|
||||
<a href="../../topics/documenting-your-api">Documenting your API</a>
|
||||
<a href="../../topics/documenting-your-api/">Documenting your API</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/internationalization">Internationalization</a>
|
||||
<a href="../../topics/internationalization/">Internationalization</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/ajax-csrf-cors">AJAX, CSRF & CORS</a>
|
||||
<a href="../../topics/ajax-csrf-cors/">AJAX, CSRF & CORS</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/browser-enhancements">Browser enhancements</a>
|
||||
<a href="../../topics/browser-enhancements/">Browser Enhancements</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/browsable-api">The Browsable API</a>
|
||||
<a href="../../topics/browsable-api/">The Browsable API</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/rest-hypermedia-hateoas">REST, Hypermedia & HATEOAS</a>
|
||||
<a href="../../topics/rest-hypermedia-hateoas/">REST, Hypermedia & HATEOAS</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/third-party-resources">Third Party Resources</a>
|
||||
<a href="../../topics/third-party-resources/">Third Party Resources</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/contributing">Contributing to REST framework</a>
|
||||
<a href="../../topics/contributing/">Contributing to REST framework</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/project-management">Project management</a>
|
||||
<a href="../../topics/project-management/">Project management</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/3.0-announcement">3.0 Announcement</a>
|
||||
<a href="../../topics/3.0-announcement/">3.0 Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/3.1-announcement">3.1 Announcement</a>
|
||||
<a href="../../topics/3.1-announcement/">3.1 Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/kickstarter-announcement">Kickstarter Announcement</a>
|
||||
<a href="../../topics/kickstarter-announcement/">Kickstarter Announcement</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="../../topics/release-notes">Release Notes</a>
|
||||
<a href="../../topics/release-notes/">Release Notes</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -300,27 +303,19 @@
|
|||
<div class="container-fluid">
|
||||
|
||||
<!-- Search Modal -->
|
||||
<div id="searchModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div id="mkdocs_search_modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3 id="myModalLabel">Documentation search</h3>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<!-- Custom google search -->
|
||||
<script>
|
||||
(function() {
|
||||
var cx = '015016005043623903336:rxraeohqk6w';
|
||||
var gcse = document.createElement('script');
|
||||
gcse.type = 'text/javascript';
|
||||
gcse.async = true;
|
||||
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
|
||||
'//www.google.com/cse/cse.js?cx=' + cx;
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(gcse, s);
|
||||
})();
|
||||
</script>
|
||||
<gcse:search></gcse:search>
|
||||
<form role="form">
|
||||
<div class="form-group">
|
||||
<input type="text" name="q" class="form-control" placeholder="Search..." id="mkdocs-search-query">
|
||||
</div>
|
||||
</form>
|
||||
<div id="mkdocs-search-results"></div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
|
|
@ -420,15 +415,18 @@
|
|||
</div>
|
||||
|
||||
<div id="main-content" class="span9">
|
||||
|
||||
|
||||
<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/routers.py">
|
||||
<span class="label | ||||