@@ -458,6 +459,8 @@ class ColourField(serializers.WritableField):
<p>The <ahref="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>
<h2id="drf-extra-fields">DRF Extra Fields</h2>
<p>The <ahref="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>
<p>The <ahref="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>
<p>The <ahref="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>
<p>The <ahref="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>
<p>A suitable replacement theme can be generated using Bootstrap's <ahref="http://twitter.github.com/bootstrap/customize.html#variables">Customize Tool</a>. There are also pre-made themes available at <ahref="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 <ahref="http://getbootstrap.com/2.3.2/customize.html">Customize Tool</a>. There are also pre-made themes available at <ahref="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>
<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 <ahref="http://twitter.github.com/bootstrap/components.html#navbar">Bootstrap components</a>.</li>
<li><code>branding</code> - Branding section of the navbar, see <ahref="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>
<h4id="components">Components</h4>
<p>All of the standard <ahref="http://twitter.github.com/bootstrap/components.html">Bootstrap components</a> are available.</p>
<p>All of the standard <ahref="http://getbootstrap.com/2.3.2/components.html">Bootstrap components</a> are available.</p>
<h4id="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>
<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>