mirror of
				https://github.com/encode/django-rest-framework.git
				synced 2025-11-04 09:57:55 +03:00 
			
		
		
		
	Merge branch 'mkdocs' of git://github.com/d0ugal/django-rest-framework into d0ugal-mkdocs
This commit is contained in:
		
						commit
						d7f8047add
					
				| 
						 | 
				
			
			@ -4,6 +4,7 @@ sudo: false
 | 
			
		|||
 | 
			
		||||
env:
 | 
			
		||||
    - TOX_ENV=py27-flake8
 | 
			
		||||
    - TOX_ENV=py27-docs
 | 
			
		||||
    - TOX_ENV=py34-django17
 | 
			
		||||
    - TOX_ENV=py33-django17
 | 
			
		||||
    - TOX_ENV=py32-django17
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -101,15 +101,15 @@ There are many great markdown editors that make working with the documentation r
 | 
			
		|||
 | 
			
		||||
## Building the documentation
 | 
			
		||||
 | 
			
		||||
To build the documentation, simply run the `mkdocs.py` script.
 | 
			
		||||
To build the documentation, install MkDocs with `pip install mkdocs` and then run the following command.
 | 
			
		||||
 | 
			
		||||
    ./mkdocs.py
 | 
			
		||||
    mkdocs build
 | 
			
		||||
 | 
			
		||||
This will build the html output into the `html` directory.
 | 
			
		||||
 | 
			
		||||
You can build the documentation and open a preview in a browser window by using the `-p` flag.
 | 
			
		||||
You can build the documentation and open a preview in a browser window by using the `serve` command.
 | 
			
		||||
 | 
			
		||||
    ./mkdocs.py -p
 | 
			
		||||
    mkdocs serve
 | 
			
		||||
 | 
			
		||||
## Language style
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
<a class="github" href="authentication.py"></a>
 | 
			
		||||
source: authentication.py
 | 
			
		||||
 | 
			
		||||
# Authentication
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
<a class="github" href="negotiation.py"></a>
 | 
			
		||||
source: negotiation.py
 | 
			
		||||
 | 
			
		||||
# Content negotiation
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
<a class="github" href="exceptions.py"></a>
 | 
			
		||||
source: exceptions.py
 | 
			
		||||
 | 
			
		||||
# Exceptions
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
<a class="github" href="fields.py"></a>
 | 
			
		||||
source: fields.py
 | 
			
		||||
 | 
			
		||||
# Serializer fields
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
<a class="github" href="filters.py"></a>
 | 
			
		||||
source: filters.py
 | 
			
		||||
 | 
			
		||||
# Filtering
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
<a class="github" href="urlpatterns.py"></a>
 | 
			
		||||
source: urlpatterns.py
 | 
			
		||||
 | 
			
		||||
# Format suffixes
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
<a class="github" href="mixins.py"></a>
 | 
			
		||||
<a class="github" href="generics.py"></a>
 | 
			
		||||
source: mixins.py
 | 
			
		||||
        generics.py
 | 
			
		||||
 | 
			
		||||
# Generic views
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
<a class="github" href="pagination.py"></a>
 | 
			
		||||
source: pagination.py
 | 
			
		||||
 | 
			
		||||
# Pagination
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
<a class="github" href="parsers.py"></a>
 | 
			
		||||
source: parsers.py
 | 
			
		||||
 | 
			
		||||
# Parsers
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
<a class="github" href="permissions.py"></a>
 | 
			
		||||
source: permissions.py
 | 
			
		||||
 | 
			
		||||
# Permissions
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
<a class="github" href="relations.py"></a>
 | 
			
		||||
source: relations.py
 | 
			
		||||
 | 
			
		||||
# Serializer relations
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
<a class="github" href="renderers.py"></a>
 | 
			
		||||
source: renderers.py
 | 
			
		||||
 | 
			
		||||
# Renderers
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
<a class="github" href="request.py"></a>
 | 
			
		||||
source: request.py
 | 
			
		||||
 | 
			
		||||
# Requests
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
<a class="github" href="response.py"></a>
 | 
			
		||||
source: response.py
 | 
			
		||||
 | 
			
		||||
# Responses
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
<a class="github" href="reverse.py"></a>
 | 
			
		||||
source: reverse.py
 | 
			
		||||
 | 
			
		||||
# Returning URLs
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
<a class="github" href="routers.py"></a>
 | 
			
		||||
source: routers.py
 | 
			
		||||
 | 
			
		||||
# Routers
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
<a class="github" href="serializers.py"></a>
 | 
			
		||||
source: serializers.py
 | 
			
		||||
 | 
			
		||||
# Serializers
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
<a class="github" href="settings.py"></a>
 | 
			
		||||
source: settings.py
 | 
			
		||||
 | 
			
		||||
# Settings
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
<a class="github" href="status.py"></a>
 | 
			
		||||
source: status.py
 | 
			
		||||
 | 
			
		||||
# Status Codes
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
<a class="github" href="test.py"></a>
 | 
			
		||||
source: test.py
 | 
			
		||||
 | 
			
		||||
# Testing
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
<a class="github" href="throttling.py"></a>
 | 
			
		||||
source: throttling.py
 | 
			
		||||
 | 
			
		||||
# Throttling
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,5 @@
 | 
			
		|||
<a class="github" href="decorators.py"></a> <a class="github" href="views.py"></a>
 | 
			
		||||
source: decorators.py
 | 
			
		||||
        views.py
 | 
			
		||||
 | 
			
		||||
# Class Based Views
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
<a class="github" href="viewsets.py"></a>
 | 
			
		||||
source: viewsets.py
 | 
			
		||||
 | 
			
		||||
# ViewSets
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -192,6 +192,18 @@ body{
 | 
			
		|||
.navbar .navbar-inner .dropdown-menu li a, .navbar .navbar-inner .dropdown-menu li{
 | 
			
		||||
 color: #A30000;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.dropdown-menu .active > a,
 | 
			
		||||
.dropdown-menu .active > a:hover {
 | 
			
		||||
  background-image: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.navbar-inverse .nav .dropdown .active > a,
 | 
			
		||||
.navbar-inverse .nav .dropdown .active > a:hover,
 | 
			
		||||
.navbar-inverse .nav .dropdown .active > a:focus {
 | 
			
		||||
  background-color: #eeeeee;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.navbar .navbar-inner .dropdown-menu li a:hover{
 | 
			
		||||
  background: #eeeeee;
 | 
			
		||||
  color: #c20000;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,9 +26,6 @@
 | 
			
		|||
<img alt="Django REST Framework" title="Logo by Jake 'Sid' Smith" src="img/logo.png" width="600px" style="display: block; margin: 0 auto 0 auto">
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
<!--
 | 
			
		||||
# Django REST framework
 | 
			
		||||
-->
 | 
			
		||||
 | 
			
		||||
Django REST framework is a powerful and flexible toolkit that makes it easy to build Web APIs.
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1 +0,0 @@
 | 
			
		|||
markdown>=2.1.0
 | 
			
		||||
| 
						 | 
				
			
			@ -1,239 +0,0 @@
 | 
			
		|||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en">
 | 
			
		||||
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 | 
			
		||||
    <meta charset="utf-8">
 | 
			
		||||
    <title>{{ title }}</title>
 | 
			
		||||
    <link href="{{ base_url }}/img/favicon.ico" rel="icon" type="image/x-icon">
 | 
			
		||||
    <link rel="canonical" href="{{ canonical_url }}"/>
 | 
			
		||||
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
 | 
			
		||||
    <meta name="description" content="{{ description }}">
 | 
			
		||||
    <meta name="author" content="Tom Christie">
 | 
			
		||||
 | 
			
		||||
    <!-- Le styles -->
 | 
			
		||||
    <link href="{{ base_url }}/css/prettify.css" rel="stylesheet">
 | 
			
		||||
    <link href="{{ base_url }}/css/bootstrap.css" rel="stylesheet">
 | 
			
		||||
    <link href="{{ base_url }}/css/bootstrap-responsive.css" rel="stylesheet">
 | 
			
		||||
    <link href="{{ base_url }}/css/default.css" rel="stylesheet">
 | 
			
		||||
 | 
			
		||||
    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
 | 
			
		||||
    <!--[if lt IE 9]>
 | 
			
		||||
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
 | 
			
		||||
    <![endif]-->
 | 
			
		||||
 | 
			
		||||
    <script type="text/javascript">
 | 
			
		||||
 | 
			
		||||
  var _gaq = _gaq || [];
 | 
			
		||||
  _gaq.push(['_setAccount', 'UA-18852272-2']);
 | 
			
		||||
  _gaq.push(['_trackPageview']);
 | 
			
		||||
 | 
			
		||||
  (function() {
 | 
			
		||||
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
 | 
			
		||||
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
 | 
			
		||||
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
 | 
			
		||||
  })();
 | 
			
		||||
 | 
			
		||||
    </script>
 | 
			
		||||
    <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_id }}-page">
 | 
			
		||||
 | 
			
		||||
  <div class="wrapper">
 | 
			
		||||
 | 
			
		||||
    <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 {{ next_url_disabled }}" href="{{ next_url }}">Next <i class="icon-arrow-right icon-white"></i></a>
 | 
			
		||||
            <a class="repo-link btn btn-inverse btn-small {{ prev_url_disabled }}" href="{{ prev_url }}"><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="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
 | 
			
		||||
            <span class="icon-bar"></span>
 | 
			
		||||
            <span class="icon-bar"></span>
 | 
			
		||||
            <span class="icon-bar"></span>
 | 
			
		||||
          </a>
 | 
			
		||||
          <a class="brand" href="{{ base_url }}{{ index }}">Django REST framework</a>
 | 
			
		||||
          <div class="nav-collapse collapse">
 | 
			
		||||
            <ul class="nav">
 | 
			
		||||
              <li><a href="{{ base_url }}{{ index }}">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="{{ base_url }}/tutorial/quickstart{{ suffix }}">Quickstart</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/tutorial/1-serialization{{ suffix }}">1 - Serialization</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/tutorial/2-requests-and-responses{{ suffix }}">2 - Requests and responses</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/tutorial/3-class-based-views{{ suffix }}">3 - Class based views</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/tutorial/4-authentication-and-permissions{{ suffix }}">4 - Authentication and permissions</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/tutorial/5-relationships-and-hyperlinked-apis{{ suffix }}">5 - Relationships and hyperlinked APIs</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/tutorial/6-viewsets-and-routers{{ suffix }}">6 - Viewsets and routers</a></li>
 | 
			
		||||
                </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="{{ base_url }}/api-guide/requests{{ suffix }}">Requests</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/api-guide/responses{{ suffix }}">Responses</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/api-guide/views{{ suffix }}">Views</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/api-guide/generic-views{{ suffix }}">Generic views</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/api-guide/viewsets{{ suffix }}">Viewsets</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/api-guide/routers{{ suffix }}">Routers</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/api-guide/parsers{{ suffix }}">Parsers</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/api-guide/renderers{{ suffix }}">Renderers</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/api-guide/serializers{{ suffix }}">Serializers</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/api-guide/fields{{ suffix }}">Serializer fields</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/api-guide/relations{{ suffix }}">Serializer relations</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/api-guide/validators{{ suffix }}">Validators</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/api-guide/authentication{{ suffix }}">Authentication</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/api-guide/permissions{{ suffix }}">Permissions</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/api-guide/throttling{{ suffix }}">Throttling</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/api-guide/filtering{{ suffix }}">Filtering</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/api-guide/pagination{{ suffix }}">Pagination</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/api-guide/content-negotiation{{ suffix }}">Content negotiation</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/api-guide/format-suffixes{{ suffix }}">Format suffixes</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/api-guide/reverse{{ suffix }}">Returning URLs</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/api-guide/exceptions{{ suffix }}">Exceptions</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/api-guide/status-codes{{ suffix }}">Status codes</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/api-guide/testing{{ suffix }}">Testing</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/api-guide/settings{{ suffix }}">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="{{ base_url }}/topics/documenting-your-api{{ suffix }}">Documenting your API</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/topics/ajax-csrf-cors{{ suffix }}">AJAX, CSRF & CORS</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/topics/browser-enhancements{{ suffix }}">Browser enhancements</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/topics/browsable-api{{ suffix }}">The Browsable API</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/topics/rest-hypermedia-hateoas{{ suffix }}">REST, Hypermedia & HATEOAS</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/topics/third-party-resources{{ suffix }}">Third Party Resources</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/topics/contributing{{ suffix }}">Contributing to REST framework</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/topics/rest-framework-2-announcement{{ suffix }}">2.0 Announcement</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/topics/2.2-announcement{{ suffix }}">2.2 Announcement</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/topics/2.3-announcement{{ suffix }}">2.3 Announcement</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/topics/2.4-announcement{{ suffix }}">2.4 Announcement</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/topics/kickstarter-announcement{{ suffix }}">Kickstarter Announcement</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/topics/release-notes{{ suffix }}">Release Notes</a></li>
 | 
			
		||||
                  <li><a href="{{ base_url }}/topics/credits{{ suffix }}">Credits</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 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>
 | 
			
		||||
  </div>
 | 
			
		||||
  <div class="modal-footer">
 | 
			
		||||
    <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
 | 
			
		||||
  </div>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
        <div class="row-fluid">
 | 
			
		||||
 | 
			
		||||
          <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>
 | 
			
		||||
          -->
 | 
			
		||||
            <div id="table-of-contents">
 | 
			
		||||
              <ul class="nav nav-list side-nav well sidebar-nav-fixed">
 | 
			
		||||
                {{ toc }}
 | 
			
		||||
              <div class="promo">
 | 
			
		||||
              {{ ad_block }}
 | 
			
		||||
              </div>
 | 
			
		||||
</ul>
 | 
			
		||||
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
 | 
			
		||||
          <div id="main-content" class="span9">
 | 
			
		||||
            {{ content }}
 | 
			
		||||
          </div><!--/span-->
 | 
			
		||||
        </div><!--/row-->
 | 
			
		||||
      </div><!--/.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>
 | 
			
		||||
  </footer>
 | 
			
		||||
 | 
			
		||||
    <!-- Le javascript
 | 
			
		||||
    ================================================== -->
 | 
			
		||||
    <!-- Placed at the end of the document so the pages load faster -->
 | 
			
		||||
    <script src="{{ base_url }}/js/jquery-1.8.1-min.js"></script>
 | 
			
		||||
    <script src="{{ base_url }}/js/prettify-1.0.js"></script>
 | 
			
		||||
    <script src="{{ base_url }}/js/bootstrap-2.1.1-min.js"></script>
 | 
			
		||||
 | 
			
		||||
    <script>
 | 
			
		||||
      //$('.side-nav').scrollspy()
 | 
			
		||||
      var shiftWindow = function() { scrollBy(0, -50) };
 | 
			
		||||
      if (location.hash) shiftWindow();
 | 
			
		||||
      window.addEventListener("hashchange", shiftWindow);
 | 
			
		||||
 | 
			
		||||
      $('.dropdown-menu').on('click touchstart', function(event) {
 | 
			
		||||
        event.stopPropagation();
 | 
			
		||||
      });
 | 
			
		||||
 | 
			
		||||
      // Dynamically force sidenav to no higher than browser window
 | 
			
		||||
      $('.side-nav').css('max-height', window.innerHeight - 130);
 | 
			
		||||
 | 
			
		||||
      $(function(){
 | 
			
		||||
        $(window).resize(function(){
 | 
			
		||||
          $('.side-nav').css('max-height', window.innerHeight - 130);
 | 
			
		||||
        });
 | 
			
		||||
      });
 | 
			
		||||
    </script>
 | 
			
		||||
</body></html>
 | 
			
		||||
| 
						 | 
				
			
			@ -135,15 +135,15 @@ There are many great Markdown editors that make working with the documentation r
 | 
			
		|||
 | 
			
		||||
## Building the documentation
 | 
			
		||||
 | 
			
		||||
To build the documentation, simply run the `mkdocs.py` script.
 | 
			
		||||
To build the documentation, install MkDocs with `pip install mkdocs` and then run the following command.
 | 
			
		||||
 | 
			
		||||
    ./mkdocs.py
 | 
			
		||||
    mkdocs build
 | 
			
		||||
 | 
			
		||||
This will build the html output into the `html` directory.
 | 
			
		||||
 | 
			
		||||
You can build the documentation and open a preview in a browser window by using the `-p` flag.
 | 
			
		||||
You can build the documentation and open a preview in a browser window by using the `serve` command.
 | 
			
		||||
 | 
			
		||||
    ./mkdocs.py -p
 | 
			
		||||
    mkdocs serve
 | 
			
		||||
 | 
			
		||||
## Language style
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,8 @@
 | 
			
		|||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en">
 | 
			
		||||
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 | 
			
		||||
 | 
			
		||||
<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">
 | 
			
		||||
| 
						 | 
				
			
			@ -21,19 +23,21 @@
 | 
			
		|||
  <![endif]-->
 | 
			
		||||
 | 
			
		||||
  <script type="text/javascript">
 | 
			
		||||
 | 
			
		||||
    var _gaq = _gaq || [];
 | 
			
		||||
    _gaq.push(['_setAccount', 'UA-18852272-2']);
 | 
			
		||||
    _gaq.push(['_trackPageview']);
 | 
			
		||||
 | 
			
		||||
    (function() {
 | 
			
		||||
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
 | 
			
		||||
      var ga = document.createElement('script');
 | 
			
		||||
      ga.type = 'text/javascript';
 | 
			
		||||
      ga.async = true;
 | 
			
		||||
      ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
 | 
			
		||||
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
 | 
			
		||||
      var s = document.getElementsByTagName('script')[0];
 | 
			
		||||
      s.parentNode.insertBefore(ga, s);
 | 
			
		||||
    })();
 | 
			
		||||
 | 
			
		||||
  </script>
 | 
			
		||||
</head>
 | 
			
		||||
 | 
			
		||||
<body onload="prettyPrint()" class="404-page">
 | 
			
		||||
 | 
			
		||||
  <div class="wrapper">
 | 
			
		||||
| 
						 | 
				
			
			@ -121,14 +125,14 @@
 | 
			
		|||
              </li>
 | 
			
		||||
            -->
 | 
			
		||||
            </ul>
 | 
			
		||||
          </div><!--/.nav-collapse -->
 | 
			
		||||
          </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 class="modal-header">
 | 
			
		||||
| 
						 | 
				
			
			@ -159,18 +163,25 @@
 | 
			
		|||
        <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></p>
 | 
			
		||||
            <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><!--/row-->
 | 
			
		||||
      </div><!--/.fluid-container-->
 | 
			
		||||
    </div><!--/.body content-->
 | 
			
		||||
          </div>
 | 
			
		||||
          <!--/span-->
 | 
			
		||||
        </div>
 | 
			
		||||
        <!--/row-->
 | 
			
		||||
      </div>
 | 
			
		||||
      <!--/.fluid-container-->
 | 
			
		||||
    </div>
 | 
			
		||||
    <!--/.body content-->
 | 
			
		||||
 | 
			
		||||
    <div id="push"></div>
 | 
			
		||||
  </div><!--/.wrapper -->
 | 
			
		||||
  </div>
 | 
			
		||||
  <!--/.wrapper -->
 | 
			
		||||
 | 
			
		||||
  <footer class="span12">
 | 
			
		||||
    <p>Sponsored by <a href="http://dabapps.com/">DabApps</a>.</a></p>
 | 
			
		||||
    <p>Sponsored by <a href="http://dabapps.com/">DabApps</a>.</a>
 | 
			
		||||
    </p>
 | 
			
		||||
  </footer>
 | 
			
		||||
 | 
			
		||||
  <!-- Le javascript
 | 
			
		||||
| 
						 | 
				
			
			@ -181,7 +192,9 @@
 | 
			
		|||
  <script src="http://www.django-rest-framework.org/js/bootstrap-2.1.1-min.js"></script>
 | 
			
		||||
  <script>
 | 
			
		||||
    //$('.side-nav').scrollspy()
 | 
			
		||||
      var shiftWindow = function() { scrollBy(0, -50) };
 | 
			
		||||
    var shiftWindow = function() {
 | 
			
		||||
      scrollBy(0, -50)
 | 
			
		||||
    };
 | 
			
		||||
    if (location.hash) shiftWindow();
 | 
			
		||||
    window.addEventListener("hashchange", shiftWindow);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -198,4 +211,6 @@
 | 
			
		|||
      });
 | 
			
		||||
    });
 | 
			
		||||
  </script>
 | 
			
		||||
</body></html>
 | 
			
		||||
</body>
 | 
			
		||||
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										196
									
								
								docs_theme/base.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										196
									
								
								docs_theme/base.html
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,196 @@
 | 
			
		|||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en">
 | 
			
		||||
 | 
			
		||||
<head>
 | 
			
		||||
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 | 
			
		||||
  <meta charset="utf-8">
 | 
			
		||||
  <title>{{ page_title }}</title>
 | 
			
		||||
  <link href="{{ base_url }}/img/favicon.ico" rel="icon" type="image/x-icon">
 | 
			
		||||
  <link rel="canonical" href="{{ canonical_url }}" />
 | 
			
		||||
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
 | 
			
		||||
  <meta name="description" content="Django, API, REST, {{ current_page.title }}">
 | 
			
		||||
  <meta name="author" content="Tom Christie">
 | 
			
		||||
 | 
			
		||||
  <!-- Le styles -->
 | 
			
		||||
  <link href="{{ base_url }}/css/prettify.css" rel="stylesheet">
 | 
			
		||||
  <link href="{{ base_url }}/css/bootstrap.css" rel="stylesheet">
 | 
			
		||||
  <link href="{{ base_url }}/css/bootstrap-responsive.css" rel="stylesheet">
 | 
			
		||||
  <link href="{{ base_url }}/css/default.css" rel="stylesheet">
 | 
			
		||||
 | 
			
		||||
  <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
 | 
			
		||||
  <!--[if lt IE 9]>
 | 
			
		||||
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
 | 
			
		||||
  <![endif]-->
 | 
			
		||||
 | 
			
		||||
  <script type="text/javascript">
 | 
			
		||||
    var _gaq = _gaq || [];
 | 
			
		||||
    _gaq.push(['_setAccount', 'UA-18852272-2']);
 | 
			
		||||
    _gaq.push(['_trackPageview']);
 | 
			
		||||
 | 
			
		||||
    (function() {
 | 
			
		||||
      var ga = document.createElement('script');
 | 
			
		||||
      ga.type = 'text/javascript';
 | 
			
		||||
      ga.async = true;
 | 
			
		||||
      ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
 | 
			
		||||
      var s = document.getElementsByTagName('script')[0];
 | 
			
		||||
      s.parentNode.insertBefore(ga, s);
 | 
			
		||||
    })();
 | 
			
		||||
  </script>
 | 
			
		||||
 | 
			
		||||
  <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="{% if current_page.is_homepage %}index{% endif %}-page">
 | 
			
		||||
 | 
			
		||||
  <div class="wrapper">
 | 
			
		||||
 | 
			
		||||
    {% include "nav.html" %}
 | 
			
		||||
 | 
			
		||||
    <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 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>
 | 
			
		||||
          </div>
 | 
			
		||||
 | 
			
		||||
          <div class="modal-footer">
 | 
			
		||||
            <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
 | 
			
		||||
        <div class="row-fluid">
 | 
			
		||||
 | 
			
		||||
          <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>
 | 
			
		||||
          -->
 | 
			
		||||
            <div id="table-of-contents">
 | 
			
		||||
              <ul class="nav nav-list side-nav well sidebar-nav-fixed">
 | 
			
		||||
 | 
			
		||||
                {% if current_page.is_homepage %}
 | 
			
		||||
                    <li class="main">
 | 
			
		||||
                        <a href="#">Django REST framework</a>
 | 
			
		||||
                    </li>
 | 
			
		||||
                {% endif %}
 | 
			
		||||
 | 
			
		||||
                {% for toc_item in toc %}
 | 
			
		||||
 | 
			
		||||
                  <li class="{% if not current_page.is_homepage %}main{% endif %}">
 | 
			
		||||
                    <a href="{{ toc_item.url }}">{{ toc_item.title }}</a>
 | 
			
		||||
                  </li>
 | 
			
		||||
 | 
			
		||||
                  {% for toc_item in toc_item.children %}
 | 
			
		||||
                    <li>
 | 
			
		||||
                      <a href="{{ toc_item.url }}">{{ toc_item.title }}</a>
 | 
			
		||||
                    </li>
 | 
			
		||||
                  {% endfor %}
 | 
			
		||||
 | 
			
		||||
                {% endfor %}
 | 
			
		||||
 | 
			
		||||
                {% if current_page.is_homepage %}
 | 
			
		||||
                <div class="promo">
 | 
			
		||||
                  <hr/>
 | 
			
		||||
                  <script type="text/javascript" src="//cdn.fusionads.net/fusion.js?zoneid=1332&serve=C6SDP2Y&placement=djangorestframework" id="_fusionads_js"></script>
 | 
			
		||||
                </div>
 | 
			
		||||
                {% endif %}
 | 
			
		||||
 | 
			
		||||
              </ul>
 | 
			
		||||
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
 | 
			
		||||
          <div id="main-content" class="span9">
 | 
			
		||||
            {% if meta.source %}
 | 
			
		||||
              {% for filename in meta.source %}
 | 
			
		||||
                <a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/{{ filename }}">
 | 
			
		||||
                  <span class="label label-info">{{ filename }}</span>
 | 
			
		||||
                </a>
 | 
			
		||||
              {% endfor %}
 | 
			
		||||
            {% endif %}
 | 
			
		||||
 | 
			
		||||
            {{ content }}
 | 
			
		||||
          </div>
 | 
			
		||||
          <!--/span-->
 | 
			
		||||
        </div>
 | 
			
		||||
        <!--/row-->
 | 
			
		||||
      </div>
 | 
			
		||||
      <!--/.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>
 | 
			
		||||
  </footer>
 | 
			
		||||
 | 
			
		||||
  <!-- Le javascript
 | 
			
		||||
  ================================================== -->
 | 
			
		||||
  <!-- Placed at the end of the document so the pages load faster -->
 | 
			
		||||
  <script src="{{ base_url }}/js/jquery-1.8.1-min.js"></script>
 | 
			
		||||
  <script src="{{ base_url }}/js/prettify-1.0.js"></script>
 | 
			
		||||
  <script src="{{ base_url }}/js/bootstrap-2.1.1-min.js"></script>
 | 
			
		||||
 | 
			
		||||
  <script>
 | 
			
		||||
    //$('.side-nav').scrollspy()
 | 
			
		||||
    var shiftWindow = function() {
 | 
			
		||||
      scrollBy(0, -50)
 | 
			
		||||
    };
 | 
			
		||||
    if (location.hash) shiftWindow();
 | 
			
		||||
    window.addEventListener("hashchange", shiftWindow);
 | 
			
		||||
 | 
			
		||||
    $('.dropdown-menu').on('click touchstart', function(event) {
 | 
			
		||||
      event.stopPropagation();
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    // Dynamically force sidenav to no higher than browser window
 | 
			
		||||
    $('.side-nav').css('max-height', window.innerHeight - 130);
 | 
			
		||||
 | 
			
		||||
    $(function() {
 | 
			
		||||
      $(window).resize(function() {
 | 
			
		||||
        $('.side-nav').css('max-height', window.innerHeight - 130);
 | 
			
		||||
      });
 | 
			
		||||
    });
 | 
			
		||||
  </script>
 | 
			
		||||
</body>
 | 
			
		||||
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										47
									
								
								docs_theme/nav.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								docs_theme/nav.html
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,47 @@
 | 
			
		|||
    <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 {% if not next_page %}disabled{% endif %}" rel="prev" {% if next_page %}href="{{ next_page.url }}"{% endif %}>
 | 
			
		||||
            Next <i class="icon-arrow-right icon-white"></i>
 | 
			
		||||
          </a>
 | 
			
		||||
          <a class="repo-link btn btn-inverse btn-small {% if not previous_page %}disabled{% endif %}" rel="next" {% if previous_page %}href="{{ previous_page.url }}"{% endif %}>
 | 
			
		||||
            <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="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
 | 
			
		||||
            <span class="icon-bar"></span>
 | 
			
		||||
            <span class="icon-bar"></span>
 | 
			
		||||
            <span class="icon-bar"></span>
 | 
			
		||||
          </a>
 | 
			
		||||
          <a class="brand" href="http://www.django-rest-framework.org">Django REST framework</a>
 | 
			
		||||
          <div class="nav-collapse collapse">
 | 
			
		||||
            {% if include_nav %}
 | 
			
		||||
            <!-- Main navigation -->
 | 
			
		||||
            <ul class="nav navbar-nav">
 | 
			
		||||
              <li {% if current_page.is_homepage %}class="active"{% endif %}><a href="/">Home</a></li>
 | 
			
		||||
              {% for nav_item in nav %} {% if nav_item.children %}
 | 
			
		||||
              <li class="dropdown{% if nav_item.active %} active{% endif %}">
 | 
			
		||||
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ nav_item.title }} <b class="caret"></b></a>
 | 
			
		||||
                <ul class="dropdown-menu">
 | 
			
		||||
                  {% for nav_item in nav_item.children %}
 | 
			
		||||
                  <li {% if nav_item.active %}class="active" {% endif %}>
 | 
			
		||||
                    <a href="{{ nav_item.url }}">{{ nav_item.title }}</a>
 | 
			
		||||
                  </li>
 | 
			
		||||
                  {% endfor %}
 | 
			
		||||
                </ul>
 | 
			
		||||
              </li>
 | 
			
		||||
              {% else %}
 | 
			
		||||
              <li {% if nav_item.active %}class="active" {% endif %}>
 | 
			
		||||
                <a href="{{ nav_item.url }}">{{ nav_item.title }}</a>
 | 
			
		||||
              </li>
 | 
			
		||||
              {% endif %} {% endfor %}
 | 
			
		||||
 | 
			
		||||
            </ul>
 | 
			
		||||
            {% endif %}
 | 
			
		||||
          </div>
 | 
			
		||||
          <!--/.nav-collapse -->
 | 
			
		||||
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
							
								
								
									
										203
									
								
								mkdocs.py
									
									
									
									
									
								
							
							
						
						
									
										203
									
								
								mkdocs.py
									
									
									
									
									
								
							| 
						 | 
				
			
			@ -1,203 +0,0 @@
 | 
			
		|||
#!/usr/bin/env python
 | 
			
		||||
 | 
			
		||||
import markdown
 | 
			
		||||
import os
 | 
			
		||||
import re
 | 
			
		||||
import shutil
 | 
			
		||||
import sys
 | 
			
		||||
 | 
			
		||||
root_dir = os.path.abspath(os.path.dirname(__file__))
 | 
			
		||||
docs_dir = os.path.join(root_dir, 'docs')
 | 
			
		||||
html_dir = os.path.join(root_dir, 'html')
 | 
			
		||||
 | 
			
		||||
local = not '--deploy' in sys.argv
 | 
			
		||||
preview = '-p' in sys.argv
 | 
			
		||||
 | 
			
		||||
if local:
 | 
			
		||||
    base_url = 'file://%s/' % os.path.normpath(os.path.join(os.getcwd(), html_dir))
 | 
			
		||||
    suffix = '.html'
 | 
			
		||||
    index = 'index.html'
 | 
			
		||||
else:
 | 
			
		||||
    base_url = 'http://www.django-rest-framework.org'
 | 
			
		||||
    suffix = ''
 | 
			
		||||
    index = ''
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
main_header = '<li class="main"><a href="#{{ anchor }}">{{ title }}</a></li>'
 | 
			
		||||
sub_header = '<li><a href="#{{ anchor }}">{{ title }}</a></li>'
 | 
			
		||||
code_label = r'<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/\1"><span class="label label-info">\1</span></a>'
 | 
			
		||||
 | 
			
		||||
page = open(os.path.join(docs_dir, 'template.html'), 'r').read()
 | 
			
		||||
 | 
			
		||||
# Copy static files
 | 
			
		||||
# for static in ['css', 'js', 'img']:
 | 
			
		||||
#     source = os.path.join(docs_dir, 'static', static)
 | 
			
		||||
#     target = os.path.join(html_dir, static)
 | 
			
		||||
#     if os.path.exists(target):
 | 
			
		||||
#         shutil.rmtree(target)
 | 
			
		||||
#     shutil.copytree(source, target)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Hacky, but what the hell, it'll do the job
 | 
			
		||||
path_list = [
 | 
			
		||||
    'index.md',
 | 
			
		||||
    'tutorial/quickstart.md',
 | 
			
		||||
    'tutorial/1-serialization.md',
 | 
			
		||||
    'tutorial/2-requests-and-responses.md',
 | 
			
		||||
    'tutorial/3-class-based-views.md',
 | 
			
		||||
    'tutorial/4-authentication-and-permissions.md',
 | 
			
		||||
    'tutorial/5-relationships-and-hyperlinked-apis.md',
 | 
			
		||||
    'tutorial/6-viewsets-and-routers.md',
 | 
			
		||||
    'api-guide/requests.md',
 | 
			
		||||
    'api-guide/responses.md',
 | 
			
		||||
    'api-guide/views.md',
 | 
			
		||||
    'api-guide/generic-views.md',
 | 
			
		||||
    'api-guide/viewsets.md',
 | 
			
		||||
    'api-guide/routers.md',
 | 
			
		||||
    'api-guide/parsers.md',
 | 
			
		||||
    'api-guide/renderers.md',
 | 
			
		||||
    'api-guide/serializers.md',
 | 
			
		||||
    'api-guide/fields.md',
 | 
			
		||||
    'api-guide/relations.md',
 | 
			
		||||
    'api-guide/validators.md',
 | 
			
		||||
    'api-guide/authentication.md',
 | 
			
		||||
    'api-guide/permissions.md',
 | 
			
		||||
    'api-guide/throttling.md',
 | 
			
		||||
    'api-guide/filtering.md',
 | 
			
		||||
    'api-guide/pagination.md',
 | 
			
		||||
    'api-guide/content-negotiation.md',
 | 
			
		||||
    'api-guide/format-suffixes.md',
 | 
			
		||||
    'api-guide/reverse.md',
 | 
			
		||||
    'api-guide/exceptions.md',
 | 
			
		||||
    'api-guide/status-codes.md',
 | 
			
		||||
    'api-guide/testing.md',
 | 
			
		||||
    'api-guide/settings.md',
 | 
			
		||||
    'topics/documenting-your-api.md',
 | 
			
		||||
    'topics/ajax-csrf-cors.md',
 | 
			
		||||
    'topics/browser-enhancements.md',
 | 
			
		||||
    'topics/browsable-api.md',
 | 
			
		||||
    'topics/rest-hypermedia-hateoas.md',
 | 
			
		||||
    'topics/third-party-resources.md',
 | 
			
		||||
    'topics/contributing.md',
 | 
			
		||||
    'topics/rest-framework-2-announcement.md',
 | 
			
		||||
    'topics/2.2-announcement.md',
 | 
			
		||||
    'topics/2.3-announcement.md',
 | 
			
		||||
    'topics/2.4-announcement.md',
 | 
			
		||||
    'topics/release-notes.md',
 | 
			
		||||
    'topics/credits.md',
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
prev_url_map = {}
 | 
			
		||||
next_url_map = {}
 | 
			
		||||
for idx in range(len(path_list)):
 | 
			
		||||
    path = path_list[idx]
 | 
			
		||||
    rel = '../' * path.count('/')
 | 
			
		||||
 | 
			
		||||
    if idx == 1 and not local:
 | 
			
		||||
        # Link back to '/', not '/index'
 | 
			
		||||
        prev_url_map[path] = '/'
 | 
			
		||||
    elif idx > 0:
 | 
			
		||||
        prev_url_map[path] = rel + path_list[idx - 1][:-3] + suffix
 | 
			
		||||
 | 
			
		||||
    if idx < len(path_list) - 1:
 | 
			
		||||
        next_url_map[path] = rel + path_list[idx + 1][:-3] + suffix
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
for (dirpath, dirnames, filenames) in os.walk(docs_dir):
 | 
			
		||||
    relative_dir = dirpath.replace(docs_dir, '').lstrip(os.path.sep)
 | 
			
		||||
    build_dir = os.path.join(html_dir, relative_dir)
 | 
			
		||||
 | 
			
		||||
    if not os.path.exists(build_dir):
 | 
			
		||||
        os.makedirs(build_dir)
 | 
			
		||||
 | 
			
		||||
    for filename in filenames:
 | 
			
		||||
        path = os.path.join(dirpath, filename)
 | 
			
		||||
        relative_path = os.path.join(relative_dir, filename)
 | 
			
		||||
 | 
			
		||||
        if not filename.endswith('.md'):
 | 
			
		||||
            if relative_dir:
 | 
			
		||||
                output_path = os.path.join(build_dir, filename)
 | 
			
		||||
                shutil.copy(path, output_path)
 | 
			
		||||
            continue
 | 
			
		||||
 | 
			
		||||
        output_path = os.path.join(build_dir, filename[:-3] + '.html')
 | 
			
		||||
 | 
			
		||||
        toc = ''
 | 
			
		||||
        text = open(path, 'r').read().decode('utf-8')
 | 
			
		||||
        main_title = None
 | 
			
		||||
        description = 'Django, API, REST'
 | 
			
		||||
        for line in text.splitlines():
 | 
			
		||||
            if line.startswith('# '):
 | 
			
		||||
                title = line[2:].strip()
 | 
			
		||||
                template = main_header
 | 
			
		||||
                description = description + ', ' + title
 | 
			
		||||
            elif line.startswith('## '):
 | 
			
		||||
                title = line[3:].strip()
 | 
			
		||||
                template = sub_header
 | 
			
		||||
            else:
 | 
			
		||||
                continue
 | 
			
		||||
 | 
			
		||||
            if not main_title:
 | 
			
		||||
                main_title = title
 | 
			
		||||
            anchor = title.lower().replace(' ', '-').replace(':-', '-').replace("'", '').replace('?', '').replace('.', '')
 | 
			
		||||
            template = template.replace('{{ title }}', title)
 | 
			
		||||
            template = template.replace('{{ anchor }}', anchor)
 | 
			
		||||
            toc += template + '\n'
 | 
			
		||||
 | 
			
		||||
        if filename == 'index.md':
 | 
			
		||||
            main_title = 'Django REST framework - Web APIs for Django'
 | 
			
		||||
        else:
 | 
			
		||||
            main_title = main_title + ' - Django REST framework'
 | 
			
		||||
 | 
			
		||||
        if relative_path == 'index.md':
 | 
			
		||||
            canonical_url = base_url
 | 
			
		||||
        else:
 | 
			
		||||
            canonical_url = base_url + '/' + relative_path[:-3] + suffix
 | 
			
		||||
        prev_url = prev_url_map.get(relative_path)
 | 
			
		||||
        next_url = next_url_map.get(relative_path)
 | 
			
		||||
 | 
			
		||||
        content = markdown.markdown(text, ['headerid'])
 | 
			
		||||
 | 
			
		||||
        output = page.replace('{{ content }}', content).replace('{{ toc }}', toc).replace('{{ base_url }}', base_url).replace('{{ suffix }}', suffix).replace('{{ index }}', index)
 | 
			
		||||
        output = output.replace('{{ title }}', main_title)
 | 
			
		||||
        output = output.replace('{{ description }}', description)
 | 
			
		||||
        output = output.replace('{{ page_id }}', filename[:-3])
 | 
			
		||||
        output = output.replace('{{ canonical_url }}', canonical_url)
 | 
			
		||||
 | 
			
		||||
        if filename =='index.md':
 | 
			
		||||
            output = output.replace('{{ ad_block }}', """<hr/>
 | 
			
		||||
              <script type="text/javascript" src="//cdn.fusionads.net/fusion.js?zoneid=1332&serve=C6SDP2Y&placement=djangorestframework" id="_fusionads_js"></script>""")
 | 
			
		||||
        else:
 | 
			
		||||
            output = output.replace('{{ ad_block }}', '')
 | 
			
		||||
 | 
			
		||||
        if prev_url:
 | 
			
		||||
            output = output.replace('{{ prev_url }}', prev_url)
 | 
			
		||||
            output = output.replace('{{ prev_url_disabled }}', '')
 | 
			
		||||
        else:
 | 
			
		||||
            output = output.replace('{{ prev_url }}', '#')
 | 
			
		||||
            output = output.replace('{{ prev_url_disabled }}', 'disabled')
 | 
			
		||||
 | 
			
		||||
        if next_url:
 | 
			
		||||
            output = output.replace('{{ next_url }}', next_url)
 | 
			
		||||
            output = output.replace('{{ next_url_disabled }}', '')
 | 
			
		||||
        else:
 | 
			
		||||
            output = output.replace('{{ next_url }}', '#')
 | 
			
		||||
            output = output.replace('{{ next_url_disabled }}', 'disabled')
 | 
			
		||||
 | 
			
		||||
        output = re.sub(r'a href="([^"]*)\.md"', r'a href="\1%s"' % suffix, output)
 | 
			
		||||
        output = re.sub(r'<pre><code>:::bash', r'<pre class="prettyprint lang-bsh">', output)
 | 
			
		||||
        output = re.sub(r'<pre>', r'<pre class="prettyprint lang-py">', output)
 | 
			
		||||
        output = re.sub(r'<a class="github" href="([^"]*)"></a>', code_label, output)
 | 
			
		||||
        open(output_path, 'w').write(output.encode('utf-8'))
 | 
			
		||||
 | 
			
		||||
if preview:
 | 
			
		||||
    import subprocess
 | 
			
		||||
 | 
			
		||||
    url = 'html/index.html'
 | 
			
		||||
 | 
			
		||||
    try:
 | 
			
		||||
        subprocess.Popen(["open", url])  # Mac
 | 
			
		||||
    except OSError:
 | 
			
		||||
        subprocess.Popen(["xdg-open", url])  # Linux
 | 
			
		||||
    except:
 | 
			
		||||
        os.startfile(url)  # Windows
 | 
			
		||||
							
								
								
									
										58
									
								
								mkdocs.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								mkdocs.yml
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,58 @@
 | 
			
		|||
site_name: Django REST framework
 | 
			
		||||
site_url: http://www.django-rest-framework.org/
 | 
			
		||||
site_description: Django REST framework - Web APIs for Django
 | 
			
		||||
 | 
			
		||||
repo_url: https://github.com/tomchristie/django-rest-framework
 | 
			
		||||
 | 
			
		||||
pages:
 | 
			
		||||
 - ['index.md', ]
 | 
			
		||||
 - ['tutorial/quickstart.md', ]
 | 
			
		||||
 - ['tutorial/1-serialization.md', 'Tutorial', '1 - Serialization']
 | 
			
		||||
 - ['tutorial/2-requests-and-responses.md', 'Tutorial', '2 - Requests and responses']
 | 
			
		||||
 - ['tutorial/3-class-based-views.md', 'Tutorial', '3 - Class based views']
 | 
			
		||||
 - ['tutorial/4-authentication-and-permissions.md', 'Tutorial', '4 - Authentication and permissions']
 | 
			
		||||
 - ['tutorial/5-relationships-and-hyperlinked-apis.md', 'Tutorial', '5 - Relationships and hyperlinked APIs']
 | 
			
		||||
 - ['tutorial/6-viewsets-and-routers.md', 'Tutorial', '6- Viewsets and routers']
 | 
			
		||||
 - ['api-guide/requests.md', 'API Guide', ]
 | 
			
		||||
 - ['api-guide/responses.md', 'API Guide', ]
 | 
			
		||||
 - ['api-guide/views.md', 'API Guide', ]
 | 
			
		||||
 - ['api-guide/generic-views.md', 'API Guide', ]
 | 
			
		||||
 - ['api-guide/viewsets.md', 'API Guide', ]
 | 
			
		||||
 - ['api-guide/routers.md', 'API Guide', ]
 | 
			
		||||
 - ['api-guide/parsers.md', 'API Guide', ]
 | 
			
		||||
 - ['api-guide/renderers.md', 'API Guide', ]
 | 
			
		||||
 - ['api-guide/serializers.md', 'API Guide', ]
 | 
			
		||||
 - ['api-guide/fields.md', 'API Guide', 'Serializer fields']
 | 
			
		||||
 - ['api-guide/relations.md', 'API Guide', 'Serializer relations']
 | 
			
		||||
 - ['api-guide/validators.md', 'API Guide', ]
 | 
			
		||||
 - ['api-guide/authentication.md', 'API Guide', ]
 | 
			
		||||
 - ['api-guide/permissions.md', 'API Guide', ]
 | 
			
		||||
 - ['api-guide/throttling.md', 'API Guide', ]
 | 
			
		||||
 - ['api-guide/filtering.md', 'API Guide', ]
 | 
			
		||||
 - ['api-guide/pagination.md', 'API Guide', ]
 | 
			
		||||
 - ['api-guide/content-negotiation.md', 'API Guide', ]
 | 
			
		||||
 - ['api-guide/format-suffixes.md', 'API Guide', ]
 | 
			
		||||
 - ['api-guide/reverse.md', 'API Guide', 'Returning URLs']
 | 
			
		||||
 - ['api-guide/exceptions.md', 'API Guide', ]
 | 
			
		||||
 - ['api-guide/status-codes.md', 'API Guide', ]
 | 
			
		||||
 - ['api-guide/testing.md', 'API Guide', ]
 | 
			
		||||
 - ['api-guide/settings.md', 'API Guide', ]
 | 
			
		||||
 - ['topics/documenting-your-api.md', 'Topics', 'Documenting your API']
 | 
			
		||||
 - ['topics/ajax-csrf-cors.md', 'Topics', 'AJAX, CSRF & CORS']
 | 
			
		||||
 - ['topics/browser-enhancements.md', 'Topics',]
 | 
			
		||||
 - ['topics/browsable-api.md', 'Topics', 'The Browsable API']
 | 
			
		||||
 - ['topics/rest-hypermedia-hateoas.md', 'Topics', 'REST, Hypermedia & HATEOAS']
 | 
			
		||||
 - ['topics/third-party-resources.md', 'Topics', 'Third Party Resources']
 | 
			
		||||
 - ['topics/contributing.md', 'Topics', 'Contributing to REST framework']
 | 
			
		||||
 - ['topics/rest-framework-2-announcement.md', 'Topics', '2.0 Announcement']
 | 
			
		||||
 - ['topics/2.2-announcement.md', 'Topics', '2.2 Announcement']
 | 
			
		||||
 - ['topics/2.3-announcement.md', 'Topics', '2.3 Announcement']
 | 
			
		||||
 - ['topics/2.4-announcement.md', 'Topics', '2.4 Announcement']
 | 
			
		||||
 - ['topics/kickstarter-announcement.md', 'Topics', 'Kickstarter Announcement']
 | 
			
		||||
 - ['topics/release-notes.md', 'Topics', 'Release Notes']
 | 
			
		||||
 - ['topics/credits.md', 'Topics', 'Credits']
 | 
			
		||||
 | 
			
		||||
site_dir: html
 | 
			
		||||
theme_dir: docs_theme
 | 
			
		||||
copyright: Copyright © 2014, <a href='https://twitter.com/_tomchristie'>Tom Christie</a>.
 | 
			
		||||
google_analytics: ['UA-18852272-2', 'django-rest-framework.org']
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user