django-select2/docs/_build/html/ref_fields.html
2012-08-31 11:34:23 +05:30

527 lines
No EOL
38 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Fields &mdash; Django-Select2 3.0 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '3.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Django-Select2 3.0 documentation" href="index.html" />
<link rel="up" title="API Reference" href="reference.html" />
<link rel="next" title="Views" href="ref_views.html" />
<link rel="prev" title="Widgets" href="ref_widgets.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="ref_views.html" title="Views"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="ref_widgets.html" title="Widgets"
accesskey="P">previous</a> |</li>
<li><a href="index.html">Django-Select2 3.0 documentation</a> &raquo;</li>
<li><a href="reference.html" accesskey="U">API Reference</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="module-django_select2.fields">
<span id="fields"></span><h1>Fields<a class="headerlink" href="#module-django_select2.fields" title="Permalink to this headline"></a></h1>
<p>Contains all the Django fields for Select2.</p>
<dl class="class">
<dt id="django_select2.fields.AutoViewFieldMixin">
<em class="property">class </em><tt class="descclassname">django_select2.fields.</tt><tt class="descname">AutoViewFieldMixin</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#django_select2.fields.AutoViewFieldMixin" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p>
<p>Registers itself with AutoResponseView.</p>
<p>All Auto fields must sub-class this mixin, so that they are registered.</p>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">Do not forget to include <tt class="docutils literal"><span class="pre">'django_select2.urls'</span></tt> in your url conf, else,
central view used to serve Auto fields won&#8217;t be available.</p>
</div>
<dl class="method">
<dt id="django_select2.fields.AutoViewFieldMixin.__init__">
<tt class="descname">__init__</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#django_select2.fields.AutoViewFieldMixin.__init__" title="Permalink to this definition"></a></dt>
<dd><p>Class constructor.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>auto_id</strong> (<tt class="xref py py-obj docutils literal"><span class="pre">unicode</span></tt>) &#8211; <p>The key to use while registering this field. If it is not provided then
an auto generated key is used.</p>
<div class="admonition tip">
<p class="first admonition-title">Tip</p>
<p>This mixin uses full class name of the field to register itself. This is
used like key in a <tt class="xref py py-obj docutils literal"><span class="pre">dict</span></tt> by <a class="reference internal" href="ref_util.html#django_select2.util.register_field" title="django_select2.util.register_field"><tt class="xref py py-func docutils literal"><span class="pre">util.register_field()</span></tt></a>.</p>
<p>If that key already exists then the instance is not registered again. So, eventually
all instances of an Auto field share one instance to respond to the Ajax queries for
its fields.</p>
<p class="last">If for some reason any instance needs to be isolated then <tt class="docutils literal"><span class="pre">auto_id</span></tt> can be used to
provide a unique key which has never occured before.</p>
</div>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="django_select2.fields.AutoViewFieldMixin.security_check">
<tt class="descname">security_check</tt><big>(</big><em>request</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#django_select2.fields.AutoViewFieldMixin.security_check" title="Permalink to this definition"></a></dt>
<dd><p>Returns <tt class="docutils literal"><span class="pre">False</span></tt> if security check fails.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>request</strong> (<tt class="xref py py-class docutils literal"><span class="pre">django.http.HttpRequest</span></tt>) &#8211; The Ajax request object.</li>
<li><strong>args</strong> &#8211; The <tt class="docutils literal"><span class="pre">*args</span></tt> passed to <tt class="xref py py-meth docutils literal"><span class="pre">django.views.generic.View.dispatch()</span></tt>.</li>
<li><strong>kwargs</strong> &#8211; The <tt class="docutils literal"><span class="pre">**kwargs</span></tt> passed to <tt class="xref py py-meth docutils literal"><span class="pre">django.views.generic.View.dispatch()</span></tt>.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">A boolean value, signalling if check passed or failed.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><tt class="xref py py-obj docutils literal"><span class="pre">bool</span></tt></p>
</td>
</tr>
</tbody>
</table>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">Sub-classes should override this. You really do not want random people making
Http reqeusts to your server, be able to get access to sensitive information.</p>
</div>
</dd></dl>
<dl class="method">
<dt id="django_select2.fields.AutoViewFieldMixin.get_results">
<tt class="descname">get_results</tt><big>(</big><em>request</em>, <em>term</em>, <em>page</em>, <em>context</em><big>)</big><a class="headerlink" href="#django_select2.fields.AutoViewFieldMixin.get_results" title="Permalink to this definition"></a></dt>
<dd><p>See <a class="reference internal" href="ref_views.html#django_select2.views.Select2View.get_results" title="django_select2.views.Select2View.get_results"><tt class="xref py py-meth docutils literal"><span class="pre">views.Select2View.get_results()</span></tt></a>.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="django_select2.fields.Select2ChoiceField">
<em class="property">class </em><tt class="descclassname">django_select2.fields.</tt><tt class="descname">Select2ChoiceField</tt><big>(</big><em>choices=()</em>, <em>required=True</em>, <em>widget=None</em>, <em>label=None</em>, <em>initial=None</em>, <em>help_text=None</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#django_select2.fields.Select2ChoiceField" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">django.forms.fields.ChoiceField</span></tt></p>
<p>Drop-in Select2 replacement for <tt class="xref py py-class docutils literal"><span class="pre">forms.ChoiceField</span></tt>.</p>
<dl class="attribute">
<dt id="django_select2.fields.Select2ChoiceField.widget">
<tt class="descname">widget</tt><a class="headerlink" href="#django_select2.fields.Select2ChoiceField.widget" title="Permalink to this definition"></a></dt>
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">Select2Widget</span></tt></p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="django_select2.fields.Select2MultipleChoiceField">
<em class="property">class </em><tt class="descclassname">django_select2.fields.</tt><tt class="descname">Select2MultipleChoiceField</tt><big>(</big><em>choices=()</em>, <em>required=True</em>, <em>widget=None</em>, <em>label=None</em>, <em>initial=None</em>, <em>help_text=None</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#django_select2.fields.Select2MultipleChoiceField" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">django.forms.fields.MultipleChoiceField</span></tt></p>
<p>Drop-in Select2 replacement for <tt class="xref py py-class docutils literal"><span class="pre">forms.MultipleChoiceField</span></tt>.</p>
<dl class="attribute">
<dt id="django_select2.fields.Select2MultipleChoiceField.widget">
<tt class="descname">widget</tt><a class="headerlink" href="#django_select2.fields.Select2MultipleChoiceField.widget" title="Permalink to this definition"></a></dt>
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">Select2MultipleWidget</span></tt></p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="django_select2.fields.ModelResultJsonMixin">
<em class="property">class </em><tt class="descclassname">django_select2.fields.</tt><tt class="descname">ModelResultJsonMixin</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#django_select2.fields.ModelResultJsonMixin" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p>
<p>Makes <tt class="docutils literal"><span class="pre">heavy_data.js</span></tt> parsable JSON response for queries on its model.</p>
<p>On query it uses <a class="reference internal" href="#django_select2.fields.ModelResultJsonMixin.prepare_qs_params" title="django_select2.fields.ModelResultJsonMixin.prepare_qs_params"><tt class="xref py py-meth docutils literal"><span class="pre">prepare_qs_params()</span></tt></a> to prepare query attributes
which it then passes to <tt class="docutils literal"><span class="pre">self.queryset.filter()</span></tt> to get the results.</p>
<p>It is expected that sub-classes will defined a class field variable
<tt class="docutils literal"><span class="pre">search_fields</span></tt>, which should be a list of field names to search for.</p>
<dl class="method">
<dt id="django_select2.fields.ModelResultJsonMixin.__init__">
<tt class="descname">__init__</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#django_select2.fields.ModelResultJsonMixin.__init__" title="Permalink to this definition"></a></dt>
<dd><p>Class constructor.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>queryset</strong> (<tt class="xref py py-class docutils literal"><span class="pre">django.db.models.query.QuerySet</span></tt> or None) &#8211; This can be passed as kwarg here or defined as field variabel,
like <tt class="docutils literal"><span class="pre">search_fields</span></tt>.</li>
<li><strong>max_results</strong> (<tt class="xref py py-obj docutils literal"><span class="pre">int</span></tt>) &#8211; Maximum number to results to return per Ajax query.</li>
<li><strong>to_field_name</strong> (<tt class="xref py py-obj docutils literal"><span class="pre">str</span></tt>) &#8211; Which field&#8217;s value should be returned as result tuple&#8217;s
value. (Default is <tt class="docutils literal"><span class="pre">pk</span></tt>, i.e. the id field of the model)</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="django_select2.fields.ModelResultJsonMixin.label_from_instance">
<tt class="descname">label_from_instance</tt><big>(</big><em>obj</em><big>)</big><a class="headerlink" href="#django_select2.fields.ModelResultJsonMixin.label_from_instance" title="Permalink to this definition"></a></dt>
<dd><p>Sub-classes should override this to generate custom label texts for values.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>obj</strong> (<tt class="xref py py-class docutils literal"><span class="pre">django.model.Model</span></tt>) &#8211; The model object.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">The label string.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><tt class="xref py py-obj docutils literal"><span class="pre">unicode</span></tt></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="django_select2.fields.ModelResultJsonMixin.prepare_qs_params">
<tt class="descname">prepare_qs_params</tt><big>(</big><em>request</em>, <em>search_term</em>, <em>search_fields</em><big>)</big><a class="headerlink" href="#django_select2.fields.ModelResultJsonMixin.prepare_qs_params" title="Permalink to this definition"></a></dt>
<dd><p>Prepares queryset parameter to use for searching.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>search_term</strong> (<tt class="xref py py-obj docutils literal"><span class="pre">list</span></tt>) &#8211; The search term.</li>
<li><strong>search_fields</strong> &#8211; The list of search fields. This is same as <tt class="docutils literal"><span class="pre">self.search_fields</span></tt>.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><p>A dictionary of parameters to &#8216;or&#8217; and &#8216;and&#8217; together. The output format should
be</p>
<div class="highlight-python"><pre>{
'or': [
Q(attr11=term11) | Q(attr12=term12) | ...,
Q(attrN1=termN1) | Q(attrN2=termN2) | ...,
...],
'and': {
'attrX1': termX1,
'attrX2': termX2,
...
}
}</pre>
</div>
<p>The above would then be coaxed into <tt class="docutils literal"><span class="pre">filter()</span></tt> as below:</p>
<div class="highlight-python"><pre>queryset.filter(
Q(attr11=term11) | Q(attr12=term12) | ...,
Q(attrN1=termN1) | Q(attrN2=termN2) | ...,
...,
attrX1=termX1,
attrX2=termX2,
...
)</pre>
</div>
<p>In this implementation, <tt class="docutils literal"><span class="pre">term11,</span> <span class="pre">term12,</span> <span class="pre">termN1,</span> <span class="pre">...</span></tt> etc., all are actually <tt class="docutils literal"><span class="pre">search_term</span></tt>.
Also then <tt class="docutils literal"><span class="pre">and</span></tt> part is always empty.</p>
<p>So, let&#8217;s take an example.</p>
<div class="line-block">
<div class="line">Assume, <tt class="docutils literal"><span class="pre">search_term</span> <span class="pre">==</span> <span class="pre">'John'</span></tt></div>
<div class="line"><tt class="docutils literal"><span class="pre">self.search_fields</span> <span class="pre">==</span> <span class="pre">['first_name__icontains',</span> <span class="pre">'last_name__icontains']</span></tt></div>
</div>
<p>So, the prepared query would be:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="p">{</span>
<span class="s">&#39;or&#39;</span><span class="p">:</span> <span class="p">[</span>
<span class="n">Q</span><span class="p">(</span><span class="n">first_name__icontains</span><span class="o">=</span><span class="n">search_term</span><span class="p">)</span> <span class="o">|</span> <span class="n">Q</span><span class="p">(</span><span class="n">last_name__icontains</span><span class="o">=</span><span class="n">search_term</span><span class="p">)</span>
<span class="p">],</span>
<span class="s">&#39;and&#39;</span><span class="p">:</span> <span class="p">{}</span>
<span class="p">}</span>
</pre></div>
</div>
</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><tt class="xref py py-obj docutils literal"><span class="pre">dict</span></tt></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="django_select2.fields.ModelResultJsonMixin.get_results">
<tt class="descname">get_results</tt><big>(</big><em>request</em>, <em>term</em>, <em>page</em>, <em>context</em><big>)</big><a class="headerlink" href="#django_select2.fields.ModelResultJsonMixin.get_results" title="Permalink to this definition"></a></dt>
<dd><p>See <a class="reference internal" href="ref_views.html#django_select2.views.Select2View.get_results" title="django_select2.views.Select2View.get_results"><tt class="xref py py-meth docutils literal"><span class="pre">views.Select2View.get_results()</span></tt></a>.</p>
<p>This implementation takes care of detecting if more results are available.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="django_select2.fields.UnhideableQuerysetType">
<em class="property">class </em><tt class="descclassname">django_select2.fields.</tt><tt class="descname">UnhideableQuerysetType</tt><a class="headerlink" href="#django_select2.fields.UnhideableQuerysetType" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">type</span></tt></p>
<p>This does some pretty nasty hacky stuff, to make sure users can
also define <tt class="docutils literal"><span class="pre">queryset</span></tt> as class-level field variable, instead of
passing it to constructor.</p>
</dd></dl>
<dl class="class">
<dt id="django_select2.fields.ChoiceMixin">
<em class="property">class </em><tt class="descclassname">django_select2.fields.</tt><tt class="descname">ChoiceMixin</tt><a class="headerlink" href="#django_select2.fields.ChoiceMixin" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p>
<p>Simple mixin which provides a property &#8211; <tt class="docutils literal"><span class="pre">choices</span></tt>. When <tt class="docutils literal"><span class="pre">choices</span></tt> is set,
then it sets that value to <tt class="docutils literal"><span class="pre">self.widget.choices</span></tt> too.</p>
</dd></dl>
<dl class="class">
<dt id="django_select2.fields.QuerysetChoiceMixin">
<em class="property">class </em><tt class="descclassname">django_select2.fields.</tt><tt class="descname">QuerysetChoiceMixin</tt><a class="headerlink" href="#django_select2.fields.QuerysetChoiceMixin" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#django_select2.fields.ChoiceMixin" title="django_select2.fields.ChoiceMixin"><tt class="xref py py-class docutils literal"><span class="pre">django_select2.fields.ChoiceMixin</span></tt></a></p>
<p>Overrides <tt class="docutils literal"><span class="pre">choices</span></tt>&#8216; getter to return instance of <tt class="xref py py-class docutils literal"><span class="pre">ModelChoiceIterator</span></tt>
instead.</p>
</dd></dl>
<dl class="class">
<dt id="django_select2.fields.ModelSelect2Field">
<em class="property">class </em><tt class="descclassname">django_select2.fields.</tt><tt class="descname">ModelSelect2Field</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#django_select2.fields.ModelSelect2Field" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">django_select2.fields.ModelChoiceField</span></tt></p>
<p>Light Select2 field, specialized for Models.</p>
<p>Select2 replacement for <tt class="xref py py-class docutils literal"><span class="pre">forms.ModelChoiceField</span></tt>.</p>
<dl class="attribute">
<dt id="django_select2.fields.ModelSelect2Field.widget">
<tt class="descname">widget</tt><a class="headerlink" href="#django_select2.fields.ModelSelect2Field.widget" title="Permalink to this definition"></a></dt>
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">Select2Widget</span></tt></p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="django_select2.fields.ModelSelect2MultipleField">
<em class="property">class </em><tt class="descclassname">django_select2.fields.</tt><tt class="descname">ModelSelect2MultipleField</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#django_select2.fields.ModelSelect2MultipleField" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">django_select2.fields.ModelMultipleChoiceField</span></tt></p>
<p>Light multiple-value Select2 field, specialized for Models.</p>
<p>Select2 replacement for <tt class="xref py py-class docutils literal"><span class="pre">forms.ModelMultipleChoiceField</span></tt>.</p>
<dl class="attribute">
<dt id="django_select2.fields.ModelSelect2MultipleField.widget">
<tt class="descname">widget</tt><a class="headerlink" href="#django_select2.fields.ModelSelect2MultipleField.widget" title="Permalink to this definition"></a></dt>
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">Select2MultipleWidget</span></tt></p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="django_select2.fields.HeavySelect2FieldBase">
<em class="property">class </em><tt class="descclassname">django_select2.fields.</tt><tt class="descname">HeavySelect2FieldBase</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#django_select2.fields.HeavySelect2FieldBase" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#django_select2.fields.ChoiceMixin" title="django_select2.fields.ChoiceMixin"><tt class="xref py py-class docutils literal"><span class="pre">django_select2.fields.ChoiceMixin</span></tt></a>, <tt class="xref py py-class docutils literal"><span class="pre">django.forms.fields.Field</span></tt></p>
<p>Base field for all Heavy fields.</p>
<dl class="method">
<dt id="django_select2.fields.HeavySelect2FieldBase.__init__">
<tt class="descname">__init__</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#django_select2.fields.HeavySelect2FieldBase.__init__" title="Permalink to this definition"></a></dt>
<dd><p>Class constructor.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>data_view</strong> (<tt class="xref py py-class docutils literal"><span class="pre">django.views.generic.View</span></tt> or None) &#8211; A <a class="reference internal" href="ref_views.html#django_select2.views.Select2View" title="django_select2.views.Select2View"><tt class="xref py py-class docutils literal"><span class="pre">Select2View</span></tt></a> sub-class which can respond to this widget&#8217;s Ajax queries.</li>
<li><strong>widget</strong> (<tt class="xref py py-class docutils literal"><span class="pre">django.forms.widgets.Widget</span></tt> or None) &#8211; A widget instance.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">Either of <tt class="docutils literal"><span class="pre">data_view</span></tt> or <tt class="docutils literal"><span class="pre">widget</span></tt> must be specified, else <tt class="xref py py-exc docutils literal"><span class="pre">ValueError</span></tt> would
be raised.</p>
</div>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="django_select2.fields.HeavySelect2ChoiceField">
<em class="property">class </em><tt class="descclassname">django_select2.fields.</tt><tt class="descname">HeavySelect2ChoiceField</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#django_select2.fields.HeavySelect2ChoiceField" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#django_select2.fields.HeavySelect2FieldBase" title="django_select2.fields.HeavySelect2FieldBase"><tt class="xref py py-class docutils literal"><span class="pre">django_select2.fields.HeavySelect2FieldBase</span></tt></a></p>
<p>Heavy Select2 Choice field.</p>
<dl class="attribute">
<dt id="django_select2.fields.HeavySelect2ChoiceField.widget">
<tt class="descname">widget</tt><a class="headerlink" href="#django_select2.fields.HeavySelect2ChoiceField.widget" title="Permalink to this definition"></a></dt>
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">HeavySelect2Widget</span></tt></p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="django_select2.fields.HeavySelect2MultipleChoiceField">
<em class="property">class </em><tt class="descclassname">django_select2.fields.</tt><tt class="descname">HeavySelect2MultipleChoiceField</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#django_select2.fields.HeavySelect2MultipleChoiceField" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#django_select2.fields.HeavySelect2FieldBase" title="django_select2.fields.HeavySelect2FieldBase"><tt class="xref py py-class docutils literal"><span class="pre">django_select2.fields.HeavySelect2FieldBase</span></tt></a></p>
<p>Heavy Select2 Multiple Choice field.</p>
<dl class="attribute">
<dt id="django_select2.fields.HeavySelect2MultipleChoiceField.widget">
<tt class="descname">widget</tt><a class="headerlink" href="#django_select2.fields.HeavySelect2MultipleChoiceField.widget" title="Permalink to this definition"></a></dt>
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">HeavySelect2MultipleWidget</span></tt></p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="django_select2.fields.HeavyModelSelect2ChoiceField">
<em class="property">class </em><tt class="descclassname">django_select2.fields.</tt><tt class="descname">HeavyModelSelect2ChoiceField</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#django_select2.fields.HeavyModelSelect2ChoiceField" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#django_select2.fields.QuerysetChoiceMixin" title="django_select2.fields.QuerysetChoiceMixin"><tt class="xref py py-class docutils literal"><span class="pre">django_select2.fields.QuerysetChoiceMixin</span></tt></a>, <a class="reference internal" href="#django_select2.fields.HeavySelect2ChoiceField" title="django_select2.fields.HeavySelect2ChoiceField"><tt class="xref py py-class docutils literal"><span class="pre">django_select2.fields.HeavySelect2ChoiceField</span></tt></a>, <tt class="xref py py-class docutils literal"><span class="pre">django_select2.fields.ModelChoiceField</span></tt></p>
<p>Heavy Select2 Choice field, specialized for Models.</p>
</dd></dl>
<dl class="class">
<dt id="django_select2.fields.HeavyModelSelect2MultipleChoiceField">
<em class="property">class </em><tt class="descclassname">django_select2.fields.</tt><tt class="descname">HeavyModelSelect2MultipleChoiceField</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#django_select2.fields.HeavyModelSelect2MultipleChoiceField" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#django_select2.fields.QuerysetChoiceMixin" title="django_select2.fields.QuerysetChoiceMixin"><tt class="xref py py-class docutils literal"><span class="pre">django_select2.fields.QuerysetChoiceMixin</span></tt></a>, <a class="reference internal" href="#django_select2.fields.HeavySelect2MultipleChoiceField" title="django_select2.fields.HeavySelect2MultipleChoiceField"><tt class="xref py py-class docutils literal"><span class="pre">django_select2.fields.HeavySelect2MultipleChoiceField</span></tt></a>, <tt class="xref py py-class docutils literal"><span class="pre">django_select2.fields.ModelMultipleChoiceField</span></tt></p>
<p>Heavy Select2 Multiple Choice field, specialized for Models.</p>
</dd></dl>
<dl class="class">
<dt id="django_select2.fields.AutoSelect2Field">
<em class="property">class </em><tt class="descclassname">django_select2.fields.</tt><tt class="descname">AutoSelect2Field</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#django_select2.fields.AutoSelect2Field" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#django_select2.fields.AutoViewFieldMixin" title="django_select2.fields.AutoViewFieldMixin"><tt class="xref py py-class docutils literal"><span class="pre">django_select2.fields.AutoViewFieldMixin</span></tt></a>, <a class="reference internal" href="#django_select2.fields.HeavySelect2ChoiceField" title="django_select2.fields.HeavySelect2ChoiceField"><tt class="xref py py-class docutils literal"><span class="pre">django_select2.fields.HeavySelect2ChoiceField</span></tt></a></p>
<p>Auto Heavy Select2 field.</p>
<p>This needs to be subclassed. The first instance of a class (sub-class) is used to serve all incoming
json query requests for that type (class).</p>
<dl class="attribute">
<dt id="django_select2.fields.AutoSelect2Field.widget">
<tt class="descname">widget</tt><a class="headerlink" href="#django_select2.fields.AutoSelect2Field.widget" title="Permalink to this definition"></a></dt>
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">AutoHeavySelect2Widget</span></tt></p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="django_select2.fields.AutoSelect2MultipleField">
<em class="property">class </em><tt class="descclassname">django_select2.fields.</tt><tt class="descname">AutoSelect2MultipleField</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#django_select2.fields.AutoSelect2MultipleField" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#django_select2.fields.AutoViewFieldMixin" title="django_select2.fields.AutoViewFieldMixin"><tt class="xref py py-class docutils literal"><span class="pre">django_select2.fields.AutoViewFieldMixin</span></tt></a>, <a class="reference internal" href="#django_select2.fields.HeavySelect2MultipleChoiceField" title="django_select2.fields.HeavySelect2MultipleChoiceField"><tt class="xref py py-class docutils literal"><span class="pre">django_select2.fields.HeavySelect2MultipleChoiceField</span></tt></a></p>
<p>Auto Heavy Select2 field for multiple choices.</p>
<p>This needs to be subclassed. The first instance of a class (sub-class) is used to serve all incoming
json query requests for that type (class).</p>
<dl class="attribute">
<dt id="django_select2.fields.AutoSelect2MultipleField.widget">
<tt class="descname">widget</tt><a class="headerlink" href="#django_select2.fields.AutoSelect2MultipleField.widget" title="Permalink to this definition"></a></dt>
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">AutoHeavySelect2MultipleWidget</span></tt></p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="django_select2.fields.AutoModelSelect2Field">
<em class="property">class </em><tt class="descclassname">django_select2.fields.</tt><tt class="descname">AutoModelSelect2Field</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#django_select2.fields.AutoModelSelect2Field" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#django_select2.fields.ModelResultJsonMixin" title="django_select2.fields.ModelResultJsonMixin"><tt class="xref py py-class docutils literal"><span class="pre">django_select2.fields.ModelResultJsonMixin</span></tt></a>, <a class="reference internal" href="#django_select2.fields.AutoViewFieldMixin" title="django_select2.fields.AutoViewFieldMixin"><tt class="xref py py-class docutils literal"><span class="pre">django_select2.fields.AutoViewFieldMixin</span></tt></a>, <a class="reference internal" href="#django_select2.fields.HeavyModelSelect2ChoiceField" title="django_select2.fields.HeavyModelSelect2ChoiceField"><tt class="xref py py-class docutils literal"><span class="pre">django_select2.fields.HeavyModelSelect2ChoiceField</span></tt></a></p>
<p>Auto Heavy Select2 field, specialized for Models.</p>
<p>This needs to be subclassed. The first instance of a class (sub-class) is used to serve all incoming
json query requests for that type (class).</p>
<dl class="attribute">
<dt id="django_select2.fields.AutoModelSelect2Field.widget">
<tt class="descname">widget</tt><a class="headerlink" href="#django_select2.fields.AutoModelSelect2Field.widget" title="Permalink to this definition"></a></dt>
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">AutoHeavySelect2Widget</span></tt></p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="django_select2.fields.AutoModelSelect2MultipleField">
<em class="property">class </em><tt class="descclassname">django_select2.fields.</tt><tt class="descname">AutoModelSelect2MultipleField</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#django_select2.fields.AutoModelSelect2MultipleField" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#django_select2.fields.ModelResultJsonMixin" title="django_select2.fields.ModelResultJsonMixin"><tt class="xref py py-class docutils literal"><span class="pre">django_select2.fields.ModelResultJsonMixin</span></tt></a>, <a class="reference internal" href="#django_select2.fields.AutoViewFieldMixin" title="django_select2.fields.AutoViewFieldMixin"><tt class="xref py py-class docutils literal"><span class="pre">django_select2.fields.AutoViewFieldMixin</span></tt></a>, <a class="reference internal" href="#django_select2.fields.HeavyModelSelect2MultipleChoiceField" title="django_select2.fields.HeavyModelSelect2MultipleChoiceField"><tt class="xref py py-class docutils literal"><span class="pre">django_select2.fields.HeavyModelSelect2MultipleChoiceField</span></tt></a></p>
<p>Auto Heavy Select2 field for multiple choices, specialized for Models.</p>
<p>This needs to be subclassed. The first instance of a class (sub-class) is used to serve all incoming
json query requests for that type (class).</p>
<dl class="attribute">
<dt id="django_select2.fields.AutoModelSelect2MultipleField.widget">
<tt class="descname">widget</tt><a class="headerlink" href="#django_select2.fields.AutoModelSelect2MultipleField.widget" title="Permalink to this definition"></a></dt>
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">AutoHeavySelect2MultipleWidget</span></tt></p>
</dd></dl>
</dd></dl>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="ref_widgets.html"
title="previous chapter">Widgets</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="ref_views.html"
title="next chapter">Views</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/ref_fields.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="ref_views.html" title="Views"
>next</a> |</li>
<li class="right" >
<a href="ref_widgets.html" title="Widgets"
>previous</a> |</li>
<li><a href="index.html">Django-Select2 3.0 documentation</a> &raquo;</li>
<li><a href="reference.html" >API Reference</a> &raquo;</li>
</ul>
</div>
<div class="footer">
&copy; Copyright 2012, Nirupam Biswas.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
</div>
</body>
</html>