mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 17:47:04 +03:00
Latest sponsor updates
This commit is contained in:
parent
3f6137116f
commit
0ed41c60de
|
@ -212,6 +212,7 @@ a.fusion-poweredby {
|
|||
<li class="main"><a href="#third-party-packages">Third party packages</a></li>
|
||||
<li><a href="#drf-compound-fields">DRF Compound Fields</a></li>
|
||||
<li><a href="#drf-extra-fields">DRF Extra Fields</a></li>
|
||||
<li><a href="#django-rest-framework-gis">django-rest-framework-gis</a></li>
|
||||
|
||||
<div class="promo">
|
||||
|
||||
|
@ -458,6 +459,8 @@ class ColourField(serializers.WritableField):
|
|||
<p>The <a href="http://drf-compound-fields.readthedocs.org">drf-compound-fields</a> package provides "compound" serializer fields, such as lists of simple values, which can be described by other fields rather than serializers with the <code>many=True</code> option. Also provided are fields for typed dictionaries and values that can be either a specific type or a list of items of that type.</p>
|
||||
<h2 id="drf-extra-fields">DRF Extra Fields</h2>
|
||||
<p>The <a href="https://github.com/Hipo/drf-extra-fields">drf-extra-fields</a> package provides extra serializer fields for REST framework, including <code>Base64ImageField</code> and <code>PointField</code> classes.</p>
|
||||
<h2 id="django-rest-framework-gis">django-rest-framework-gis</h2>
|
||||
<p>The <a href="https://github.com/djangonauts/django-rest-framework-gis">django-rest-framework-gis</a> package provides geographic addons for django rest framework like a <code>GeometryField</code> field and a GeoJSON serializer.</p>
|
||||
</div><!--/span-->
|
||||
</div><!--/row-->
|
||||
</div><!--/.fluid-container-->
|
||||
|
|
|
@ -208,6 +208,7 @@ a.fusion-poweredby {
|
|||
<li><a href="#customising-the-default-fields">Customising the default fields</a></li>
|
||||
<li class="main"><a href="#third-party-packages">Third party packages</a></li>
|
||||
<li><a href="#mongoenginemodelserializer">MongoengineModelSerializer</a></li>
|
||||
<li><a href="#geofeaturemodelserializer">GeoFeatureModelSerializer</a></li>
|
||||
|
||||
<div class="promo">
|
||||
|
||||
|
@ -669,6 +670,8 @@ The <code>ModelSerializer</code> class lets you automatically create a Serialize
|
|||
<p>The following third party packages are also available.</p>
|
||||
<h2 id="mongoenginemodelserializer">MongoengineModelSerializer</h2>
|
||||
<p>The <a href="https://github.com/umutbozkurt/django-rest-framework-mongoengine">django-rest-framework-mongoengine</a> package provides a <code>MongoEngineModelSerializer</code> serializer class that supports using MongoDB as the storage layer for Django REST framework.</p>
|
||||
<h2 id="geofeaturemodelserializer">GeoFeatureModelSerializer</h2>
|
||||
<p>The <a href="https://github.com/djangonauts/django-rest-framework-gis">django-rest-framework-gis</a> package provides a <code>GeoFeatureModelSerializer</code> serializer class that supports GeoJSON both for read and write operations.</p>
|
||||
</div><!--/span-->
|
||||
</div><!--/row-->
|
||||
</div><!--/.fluid-container-->
|
||||
|
|
|
@ -249,7 +249,7 @@ class ExampleView(APIView):
|
|||
return Response(content)
|
||||
</code></pre>
|
||||
<p>Or, if you're using the <code>@api_view</code> decorator with function based views.</p>
|
||||
<pre class="prettyprint lang-py"><code>@api_view('GET')
|
||||
<pre class="prettyprint lang-py"><code>@api_view(['GET'])
|
||||
@throttle_classes([UserRateThrottle])
|
||||
def example_view(request, format=None):
|
||||
content = {
|
||||
|
|
BIN
img/sponsors/3-openeye.png
Normal file
BIN
img/sponsors/3-openeye.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
BIN
img/sponsors/3-teonite.png
Normal file
BIN
img/sponsors/3-teonite.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.7 KiB |
|
@ -222,7 +222,7 @@ a.fusion-poweredby {
|
|||
<link rel="stylesheet" href="/path/to/my/bootstrap.css" type="text/css">
|
||||
{% endblock %}
|
||||
</code></pre>
|
||||
<p>A suitable replacement theme can be generated using Bootstrap's <a href="http://twitter.github.com/bootstrap/customize.html#variables">Customize Tool</a>. There are also pre-made themes available at <a href="http://bootswatch.com/">Bootswatch</a>. To use any of the Bootswatch themes, simply download the theme's <code>bootstrap.min.css</code> file, add it to your project, and replace the default one as described above.</p>
|
||||
<p>A suitable replacement theme can be generated using Bootstrap's <a href="http://getbootstrap.com/2.3.2/customize.html">Customize Tool</a>. There are also pre-made themes available at <a href="http://bootswatch.com/">Bootswatch</a>. To use any of the Bootswatch themes, simply download the theme's <code>bootstrap.min.css</code> file, add it to your project, and replace the default one as described above.</p>
|
||||
<p>You can also change the navbar variant, which by default is <code>navbar-inverse</code>, using the <code>bootstrap_navbar_variant</code> block. The empty <code>{% block bootstrap_navbar_variant %}{% endblock %}</code> will use the original Bootstrap navbar style.</p>
|
||||
<p>Full example:</p>
|
||||
<pre class="prettyprint lang-py"><code>{% extends "rest_framework/base.html" %}
|
||||
|
@ -247,7 +247,7 @@ a.fusion-poweredby {
|
|||
<li><code>bodyclass</code> - Class attribute for the <code><body></code> tag, empty by default.</li>
|
||||
<li><code>bootstrap_theme</code> - CSS for the Bootstrap theme.</li>
|
||||
<li><code>bootstrap_navbar_variant</code> - CSS class for the navbar.</li>
|
||||
<li><code>branding</code> - Branding section of the navbar, see <a href="http://twitter.github.com/bootstrap/components.html#navbar">Bootstrap components</a>.</li>
|
||||
<li><code>branding</code> - Branding section of the navbar, see <a href="http://getbootstrap.com/2.3.2/components.html#navbar">Bootstrap components</a>.</li>
|
||||
<li><code>breadcrumbs</code> - Links showing resource nesting, allowing the user to go back up the resources. It's recommended to preserve these, but they can be overridden using the breadcrumbs block.</li>
|
||||
<li><code>footer</code> - Any copyright notices or similar footer materials can go here (by default right-aligned).</li>
|
||||
<li><code>script</code> - JavaScript files for the page.</li>
|
||||
|
@ -256,7 +256,7 @@ a.fusion-poweredby {
|
|||
<li><code>userlinks</code> - This is a list of links on the right of the header, by default containing login/logout links. To add links instead of replace, use <code>{{ block.super }}</code> to preserve the authentication links.</li>
|
||||
</ul>
|
||||
<h4 id="components">Components</h4>
|
||||
<p>All of the standard <a href="http://twitter.github.com/bootstrap/components.html">Bootstrap components</a> are available.</p>
|
||||
<p>All of the standard <a href="http://getbootstrap.com/2.3.2/components.html">Bootstrap components</a> are available.</p>
|
||||
<h4 id="tooltips">Tooltips</h4>
|
||||
<p>The browsable API makes use of the Bootstrap tooltips component. Any element with the <code>js-tooltip</code> class and a <code>title</code> attribute has that title content will display a tooltip on hover events.</p>
|
||||
<h3 id="login-template">Login Template</h3>
|
||||
|
|
|
@ -298,7 +298,6 @@ a.fusion-poweredby {
|
|||
<li><a href="http://www.aba-systems.com.au/" rel="nofollow" style="background-image:url(../img/sponsors/3-aba.png);">ABA Systems</a></li>
|
||||
<li><a href="http://beefarm.ru/" rel="nofollow" style="background-image:url(../img/sponsors/3-beefarm.png);">beefarm.ru</a></li>
|
||||
<li><a href="http://www.vzzual.com/" rel="nofollow" style="background-image:url(../img/sponsors/3-vzzual.png);">Vzzual.com</a></li>
|
||||
<!--Vzzual-->
|
||||
<!--Linovia-->
|
||||
<li><a href="http://infinite-code.com/" rel="nofollow" style="background-image:url(../img/sponsors/3-infinite_code.png);">Infinite Code</a></li>
|
||||
<!--Jon-->
|
||||
|
@ -307,16 +306,17 @@ a.fusion-poweredby {
|
|||
<li><a href="http://blimp.io/" rel="nofollow" style="background-image:url(../img/sponsors/3-blimp.png);">Blimp</a></li>
|
||||
<li><a href="http://pathwright.com" rel="nofollow" style="background-image:url(../img/sponsors/3-pathwright.png);">Pathwright</a></li>
|
||||
<li><a href="http://fluxility.com/" rel="nofollow" style="background-image:url(../img/sponsors/3-fluxility.png);">Fluxility</a></li>
|
||||
<li><a href="http://teonite.com/" rel="nofollow" style="background-image:url(../img/sponsors/3-teonite.png);">Teonite</a></li>
|
||||
<li><a href="http://trackmaven.com/" rel="nofollow" style="background-image:url(../img/sponsors/3-trackmaven.png);">TrackMaven</a></li>
|
||||
<li><a href="http://www.nephila.co.uk/" rel="nofollow" style="background-image:url(../img/sponsors/3-nephila.png);">Nephila</a></li>
|
||||
<!--Haris-->
|
||||
<li><a href="http://www.aditium.com/" rel="nofollow" style="background-image:url(../img/sponsors/3-aditium.png);">Aditium</a></li>
|
||||
<!--Craig-->
|
||||
<li><a href="http://www.eyesopen.com/" rel="nofollow" style="background-image:url(../img/sponsors/3-openeye.png);">OpenEye Scientific Software</a></li>
|
||||
</ul>
|
||||
|
||||
<div style="clear: both; padding-bottom: 20px;"></div>
|
||||
|
||||
<p><strong>Individual contributions</strong>: Paul Hallet, <a href="http://www.paulwhippconsulting.com/">Paul Whipp</a>, Jannis Leidel, <a href="http://spielmannsolutions.com/">Johannes Spielmann</a>, <a href="http://chrisheisel.com/">Chris Heisel</a>, Marwan Alsabbagh.</p>
|
||||
<p><strong>Individual contributions</strong>: Paul Hallet, <a href="http://www.paulwhippconsulting.com/">Paul Whipp</a>, Jannis Leidel, <a href="http://spielmannsolutions.com/">Johannes Spielmann</a>, <a href="http://brooklynhacker.com/">Rob Spectre</a>, <a href="http://chrisheisel.com/">Chris Heisel</a>, Marwan Alsabbagh.</p>
|
||||
</div><!--/span-->
|
||||
</div><!--/row-->
|
||||
</div><!--/.fluid-container-->
|
||||
|
|
|
@ -223,7 +223,7 @@ def api_root(request, format=None):
|
|||
<p>The other obvious thing that's still missing from our pastebin API is the code highlighting endpoints.</p>
|
||||
<p>Unlike all our other API endpoints, we don't want to use JSON, but instead just present an HTML representation. There are two styles of HTML renderer provided by REST framework, one for dealing with HTML rendered using templates, the other for dealing with pre-rendered HTML. The second renderer is the one we'd like to use for this endpoint.</p>
|
||||
<p>The other thing we need to consider when creating the code highlight view is that there's no existing concrete generic view that we can use. We're not returning an object instance, but instead a property of an object instance.</p>
|
||||
<p>Instead of using a concrete generic view, we'll use the base class for representing instances, and create our own <code>.get()</code> method. In your snippets.views add:</p>
|
||||
<p>Instead of using a concrete generic view, we'll use the base class for representing instances, and create our own <code>.get()</code> method. In your <code>snippets.views</code> add:</p>
|
||||
<pre class="prettyprint lang-py"><code>from rest_framework import renderers
|
||||
from rest_framework.response import Response
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user