mirror of
https://github.com/Hopiu/django-select2.git
synced 2026-03-20 07:10:24 +00:00
705 lines
No EOL
63 KiB
HTML
705 lines
No EOL
63 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 — Django-Select2 3.0.1 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.1',
|
|
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.1 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.1 documentation</a> »</li>
|
|
<li><a href="reference.html" accesskey="U">API Reference</a> »</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="document">
|
|
<div class="documentwrapper">
|
|
<div class="bodywrapper">
|
|
<div class="body">
|
|
|
|
<div class="section" id="fields">
|
|
<h1>Fields<a class="headerlink" href="#fields" title="Permalink to this headline">¶</a></h1>
|
|
<div class="section" id="class-diagrams">
|
|
<h2>Class Diagrams<a class="headerlink" href="#class-diagrams" title="Permalink to this headline">¶</a></h2>
|
|
<p class="graphviz">
|
|
<img src="_images/inheritance-88dec5533f5bfed5f1c78156107e6abfdec33433.png" alt="Inheritance diagram of django_select2.fields.Select2ChoiceField, django_select2.fields.Select2MultipleChoiceField" usemap="#inheritance25da809ef3" class="inheritance"/>
|
|
<map id="inheritance25da809ef3" name="inheritance25da809ef3">
|
|
<area shape="poly" id="node8" href="#django_select2.fields.Select2ChoiceField" title="Select2ChoiceField" alt="" coords="459,188,454,183,440,178,418,174,391,172,360,171,329,172,302,174,280,178,266,183,261,188,266,193,280,198,302,202,329,204,360,205,391,204,418,202,440,198,454,193"/>
|
|
<area shape="poly" id="node4" href="#django_select2.fields.Select2MultipleChoiceField" title="Select2MultipleChoiceField" alt="" coords="270,271,264,265,245,261,215,257,178,255,137,254,96,255,59,257,30,261,11,265,4,271,11,276,30,281,59,284,96,287,137,288,178,287,215,284,245,281,264,276"/>
|
|
</map>
|
|
</p>
|
|
<p class="graphviz">
|
|
<img src="_images/inheritance-ad0befd50612306d963f57238e5636f0cf941700.png" alt="Inheritance diagram of django_select2.fields.ModelSelect2Field, django_select2.fields.ModelSelect2MultipleField" usemap="#inheritance2f6096d7d4" class="inheritance"/>
|
|
<map id="inheritance2f6096d7d4" name="inheritance2f6096d7d4">
|
|
<area shape="poly" id="node4" href="#django_select2.fields.ModelSelect2Field" title="ModelSelect2Field" alt="" coords="195,271,191,265,177,261,156,257,129,255,100,254,71,255,44,257,23,261,9,265,5,271,9,276,23,281,44,284,71,287,100,288,129,287,156,284,177,281,191,276"/>
|
|
<area shape="poly" id="node15" href="#django_select2.fields.ModelSelect2MultipleField" title="ModelSelect2MultipleField" alt="" coords="474,353,468,348,450,343,421,340,385,337,345,336,305,337,269,340,241,343,222,348,216,353,222,359,241,363,269,367,305,369,345,370,385,369,421,367,450,363,468,359"/>
|
|
</map>
|
|
</p>
|
|
<p class="graphviz">
|
|
<img src="_images/inheritance-53de5bc32ecd93d09a06994c473f76aeab86e5ad.png" alt="Inheritance diagram of django_select2.fields.HeavyModelSelect2ChoiceField, django_select2.fields.HeavyModelSelect2MultipleChoiceField" usemap="#inheritance4f5879fafb" class="inheritance"/>
|
|
<map id="inheritance4f5879fafb" name="inheritance4f5879fafb">
|
|
<area shape="poly" id="node17" href="#django_select2.fields.HeavyModelSelect2ChoiceField" title="HeavyModelSelect2ChoiceField" alt="" coords="454,271,447,265,425,261,392,257,350,255,303,254,256,255,213,257,180,261,158,265,151,271,158,276,180,281,213,284,256,287,303,288,350,287,392,284,425,281,447,276"/>
|
|
<area shape="poly" id="node14" href="#django_select2.fields.HeavyModelSelect2MultipleChoiceField" title="HeavyModelSelect2MultipleChoiceField" alt="" coords="544,353,535,348,509,343,468,340,416,337,359,336,301,337,249,340,208,343,182,348,173,353,182,359,208,363,249,367,301,369,359,370,416,369,468,367,509,363,535,359"/>
|
|
<area shape="poly" id="node13" href="#django_select2.fields.HeavySelect2FieldBaseMixin" title="HeavySelect2FieldBaseMixin" alt="" coords="281,188,274,183,255,178,224,174,185,172,143,171,100,172,61,174,31,178,11,183,4,188,11,193,31,198,61,202,100,204,143,205,185,204,224,202,255,198,274,193"/>
|
|
</map>
|
|
</p>
|
|
<p class="graphviz">
|
|
<img src="_images/inheritance-b65738d86644639b081c60cc21b5ceb0047569d2.png" alt="Inheritance diagram of django_select2.fields.AutoSelect2Field, django_select2.fields.AutoSelect2MultipleField" usemap="#inheritanceea81e519c1" class="inheritance"/>
|
|
<map id="inheritanceea81e519c1" name="inheritanceea81e519c1">
|
|
<area shape="poly" id="node1" href="#django_select2.fields.HeavyChoiceField" title="HeavyChoiceField" alt="" coords="463,105,459,100,445,95,425,92,399,89,371,88,342,89,316,92,296,95,283,100,278,105,283,111,296,115,316,119,342,121,371,122,399,121,425,119,445,115,459,111"/>
|
|
<area shape="poly" id="node7" href="#django_select2.fields.HeavySelect2ChoiceField" title="HeavySelect2ChoiceField" alt="" coords="256,271,250,265,232,261,204,257,169,255,131,254,92,255,57,257,29,261,11,265,5,271,11,276,29,281,57,284,92,287,131,288,169,287,204,284,232,281,250,276"/>
|
|
<area shape="poly" id="node13" href="#django_select2.fields.HeavyMultipleChoiceField" title="HeavyMultipleChoiceField" alt="" coords="778,188,772,183,754,178,726,174,691,172,652,171,613,172,578,174,550,178,532,183,526,188,532,193,550,198,578,202,613,204,652,205,691,204,726,202,754,198,772,193"/>
|
|
<area shape="poly" id="node2" href="#django_select2.fields.ChoiceMixin" title="ChoiceMixin" alt="" coords="375,23,372,17,362,13,347,9,329,7,308,6,287,7,269,9,254,13,244,17,241,23,244,28,254,33,269,36,287,39,308,40,329,39,347,36,362,33,372,28"/>
|
|
<area shape="poly" id="node6" href="#django_select2.fields.AutoViewFieldMixin" title="AutoViewFieldMixin" alt="" coords="477,271,472,265,458,261,436,257,409,255,379,254,348,255,321,257,299,261,285,265,281,271,285,276,299,281,321,284,348,287,379,288,409,287,436,284,458,281,472,276"/>
|
|
<area shape="poly" id="node15" href="#django_select2.fields.AutoSelect2MultipleField" title="AutoSelect2MultipleField" alt="" coords="624,353,617,348,600,343,573,340,538,337,500,336,462,337,427,340,400,343,383,348,376,353,383,359,400,363,427,367,462,369,500,370,538,369,573,367,600,363,617,359"/>
|
|
<area shape="poly" id="node18" href="#django_select2.fields.AutoSelect2Field" title="AutoSelect2Field" alt="" coords="347,353,343,348,330,343,310,340,285,337,257,336,230,337,205,340,185,343,172,348,168,353,172,359,185,363,205,367,230,369,257,370,285,369,310,367,330,363,343,359"/>
|
|
<area shape="poly" id="node8" href="#django_select2.fields.HeavySelect2FieldBaseMixin" title="HeavySelect2FieldBaseMixin" alt="" coords="485,188,478,183,459,178,428,174,389,172,347,171,304,172,265,174,235,178,215,183,208,188,215,193,235,198,265,202,304,204,347,205,389,204,428,202,459,198,478,193"/>
|
|
<area shape="poly" id="node11" href="#django_select2.fields.HeavySelect2MultipleChoiceField" title="HeavySelect2MultipleChoiceField" alt="" coords="819,271,812,265,789,261,754,257,709,255,660,254,611,255,566,257,531,261,508,265,501,271,508,276,531,281,566,284,611,287,660,288,709,287,754,284,789,281,812,276"/>
|
|
</map>
|
|
</p>
|
|
<p class="graphviz">
|
|
<img src="_images/inheritance-33c09aa571160e654cfd73c711c0d2cfac17a52c.png" alt="Inheritance diagram of django_select2.fields.AutoModelSelect2Field" usemap="#inheritance0bde21cdb9" class="inheritance"/>
|
|
<map id="inheritance0bde21cdb9" name="inheritance0bde21cdb9">
|
|
<area shape="poly" id="node11" href="#django_select2.fields.HeavyModelSelect2ChoiceField" title="HeavyModelSelect2ChoiceField" alt="" coords="772,271,764,265,743,261,709,257,667,255,620,254,573,255,531,257,497,261,476,265,468,271,476,276,497,281,531,284,573,287,620,288,667,287,709,284,743,281,764,276"/>
|
|
<area shape="poly" id="node4" href="#django_select2.fields.AutoViewFieldMixin" title="AutoViewFieldMixin" alt="" coords="201,271,196,265,182,261,160,257,133,255,103,254,72,255,45,257,23,261,9,265,5,271,9,276,23,281,45,284,72,287,103,288,133,287,160,284,182,281,196,276"/>
|
|
<area shape="poly" id="node8" href="#django_select2.fields.AutoModelSelect2Field" title="AutoModelSelect2Field" alt="" coords="451,353,445,348,428,343,403,340,371,337,335,336,299,337,267,340,241,343,224,348,219,353,224,359,241,363,267,367,299,369,335,370,371,369,403,367,428,363,445,359"/>
|
|
<area shape="poly" id="node5" href="#django_select2.fields.ModelResultJsonMixin" title="ModelResultJsonMixin" alt="" coords="444,271,439,265,423,261,399,257,368,255,335,254,301,255,270,257,246,261,231,265,225,271,231,276,246,281,270,284,301,287,335,288,368,287,399,284,423,281,439,276"/>
|
|
<area shape="poly" id="node16" href="#django_select2.fields.HeavySelect2FieldBaseMixin" title="HeavySelect2FieldBaseMixin" alt="" coords="631,188,624,183,604,178,573,174,535,172,492,171,449,172,411,174,380,178,360,183,353,188,360,193,380,198,411,202,449,204,492,205,535,204,573,202,604,198,624,193"/>
|
|
</map>
|
|
</p>
|
|
<p class="graphviz">
|
|
<img src="_images/inheritance-2a5d737bd98b0ddb0f26a84b32e0bab0307aa8a1.png" alt="Inheritance diagram of django_select2.fields.AutoModelSelect2MultipleField" usemap="#inheritancea008ca3d81" class="inheritance"/>
|
|
<map id="inheritancea008ca3d81" name="inheritancea008ca3d81">
|
|
<area shape="poly" id="node4" href="#django_select2.fields.AutoViewFieldMixin" title="AutoViewFieldMixin" alt="" coords="201,353,196,348,182,343,160,340,133,337,103,336,72,337,45,340,23,343,9,348,5,353,9,359,23,363,45,367,72,369,103,370,133,369,160,367,182,363,196,359"/>
|
|
<area shape="poly" id="node6" href="#django_select2.fields.AutoModelSelect2MultipleField" title="AutoModelSelect2MultipleField" alt="" coords="485,436,477,431,456,426,423,422,381,420,335,419,288,420,247,422,213,426,192,431,185,436,192,441,213,446,247,450,288,452,335,453,381,452,423,450,456,446,477,441"/>
|
|
<area shape="poly" id="node5" href="#django_select2.fields.ModelResultJsonMixin" title="ModelResultJsonMixin" alt="" coords="444,353,439,348,423,343,399,340,368,337,335,336,301,337,270,340,246,343,231,348,225,353,231,359,246,363,270,367,301,369,335,370,368,369,399,367,423,363,439,359"/>
|
|
<area shape="poly" id="node9" href="#django_select2.fields.HeavyModelSelect2MultipleChoiceField" title="HeavyModelSelect2MultipleChoiceField" alt="" coords="839,353,830,348,804,343,763,340,711,337,653,336,596,337,544,340,503,343,477,348,468,353,477,359,503,363,544,367,596,369,653,370,711,369,763,367,804,363,830,359"/>
|
|
<area shape="poly" id="node17" href="#django_select2.fields.HeavySelect2FieldBaseMixin" title="HeavySelect2FieldBaseMixin" alt="" coords="647,271,640,265,620,261,589,257,551,255,508,254,465,255,427,257,396,261,376,265,369,271,376,276,396,281,427,284,465,287,508,288,551,287,589,284,620,281,640,276"/>
|
|
</map>
|
|
</p>
|
|
</div>
|
|
<div class="section" id="module-django_select2.fields">
|
|
<span id="reference"></span><h2>Reference<a class="headerlink" href="#module-django_select2.fields" title="Permalink to this headline">¶</a></h2>
|
|
<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="reference internal" href="_modules/django_select2/fields.html#AutoViewFieldMixin"><span class="viewcode-link">[source]</span></a><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’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="reference internal" href="_modules/django_select2/fields.html#AutoViewFieldMixin.__init__"><span class="viewcode-link">[source]</span></a><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> (<a class="reference external" href="http://docs.python.org/2.7/library/functions.html#unicode" title="(in Python v2.7)"><tt class="xref py py-obj docutils literal"><span class="pre">unicode</span></tt></a>) – <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 <a class="reference external" href="http://docs.python.org/2.7/library/stdtypes.html#dict" title="(in Python v2.7)"><tt class="xref py py-obj docutils literal"><span class="pre">dict</span></tt></a> 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="reference internal" href="_modules/django_select2/fields.html#AutoViewFieldMixin.security_check"><span class="viewcode-link">[source]</span></a><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> (<a class="reference external" href="https://docs.djangoproject.com/en/1.4/ref/request-response/#django.http.HttpRequest" title="(in Django v1.4.1)"><tt class="xref py py-class docutils literal"><span class="pre">django.http.HttpRequest</span></tt></a>) – The Ajax request object.</li>
|
|
<li><strong>args</strong> – The <tt class="docutils literal"><span class="pre">*args</span></tt> passed to <a class="reference external" href="https://docs.djangoproject.com/en/1.4/ref/class-based-views/#django.views.generic.base.View.dispatch" title="(in Django v1.4.1)"><tt class="xref py py-meth docutils literal"><span class="pre">django.views.generic.base.View.dispatch()</span></tt></a>.</li>
|
|
<li><strong>kwargs</strong> – The <tt class="docutils literal"><span class="pre">**kwargs</span></tt> passed to <a class="reference external" href="https://docs.djangoproject.com/en/1.4/ref/class-based-views/#django.views.generic.base.View.dispatch" title="(in Django v1.4.1)"><tt class="xref py py-meth docutils literal"><span class="pre">django.views.generic.base.View.dispatch()</span></tt></a>.</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"><a class="reference external" href="http://docs.python.org/2.7/library/functions.html#bool" title="(in Python v2.7)"><tt class="xref py py-obj docutils literal"><span class="pre">bool</span></tt></a></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="reference internal" href="_modules/django_select2/fields.html#AutoViewFieldMixin.get_results"><span class="viewcode-link">[source]</span></a><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="reference internal" href="_modules/django_select2/fields.html#Select2ChoiceField"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django_select2.fields.Select2ChoiceField" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Bases: <a class="reference external" href="https://docs.djangoproject.com/en/1.4/ref/forms/fields/#django.forms.ChoiceField" title="(in Django v1.4.1)"><tt class="xref py py-class docutils literal"><span class="pre">django.forms.fields.ChoiceField</span></tt></a></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="reference internal" href="_modules/django_select2/fields.html#Select2MultipleChoiceField"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django_select2.fields.Select2MultipleChoiceField" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Bases: <a class="reference external" href="https://docs.djangoproject.com/en/1.4/ref/forms/fields/#django.forms.MultipleChoiceField" title="(in Django v1.4.1)"><tt class="xref py py-class docutils literal"><span class="pre">django.forms.fields.MultipleChoiceField</span></tt></a></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="reference internal" href="_modules/django_select2/fields.html#ModelResultJsonMixin"><span class="viewcode-link">[source]</span></a><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="reference internal" href="_modules/django_select2/fields.html#ModelResultJsonMixin.__init__"><span class="viewcode-link">[source]</span></a><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> (<a class="reference external" href="https://docs.djangoproject.com/en/1.4/ref/models/querysets/#django.db.models.query.QuerySet" title="(in Django v1.4.1)"><tt class="xref py py-class docutils literal"><span class="pre">django.db.models.query.QuerySet</span></tt></a> or None) – 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> (<a class="reference external" href="http://docs.python.org/2.7/library/functions.html#int" title="(in Python v2.7)"><tt class="xref py py-obj docutils literal"><span class="pre">int</span></tt></a>) – Maximum number to results to return per Ajax query.</li>
|
|
<li><strong>to_field_name</strong> (<a class="reference external" href="http://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><tt class="xref py py-obj docutils literal"><span class="pre">str</span></tt></a>) – Which field’s value should be returned as result tuple’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="reference internal" href="_modules/django_select2/fields.html#ModelResultJsonMixin.label_from_instance"><span class="viewcode-link">[source]</span></a><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>) – 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"><a class="reference external" href="http://docs.python.org/2.7/library/functions.html#unicode" title="(in Python v2.7)"><tt class="xref py py-obj docutils literal"><span class="pre">unicode</span></tt></a></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="reference internal" href="_modules/django_select2/fields.html#ModelResultJsonMixin.prepare_qs_params"><span class="viewcode-link">[source]</span></a><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> (<a class="reference external" href="http://docs.python.org/2.7/library/functions.html#list" title="(in Python v2.7)"><tt class="xref py py-obj docutils literal"><span class="pre">list</span></tt></a>) – The search term.</li>
|
|
<li><strong>search_fields</strong> – 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 ‘or’ and ‘and’ 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’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">'or'</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">'and'</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"><a class="reference external" href="http://docs.python.org/2.7/library/stdtypes.html#dict" title="(in Python v2.7)"><tt class="xref py py-obj docutils literal"><span class="pre">dict</span></tt></a></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="reference internal" href="_modules/django_select2/fields.html#ModelResultJsonMixin.get_results"><span class="viewcode-link">[source]</span></a><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="reference internal" href="_modules/django_select2/fields.html#UnhideableQuerysetType"><span class="viewcode-link">[source]</span></a><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="reference internal" href="_modules/django_select2/fields.html#ChoiceMixin"><span class="viewcode-link">[source]</span></a><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 – <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="reference internal" href="_modules/django_select2/fields.html#QuerysetChoiceMixin"><span class="viewcode-link">[source]</span></a><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>‘ 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="reference internal" href="_modules/django_select2/fields.html#ModelSelect2Field"><span class="viewcode-link">[source]</span></a><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="reference internal" href="_modules/django_select2/fields.html#ModelSelect2MultipleField"><span class="viewcode-link">[source]</span></a><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.HeavySelect2FieldBaseMixin">
|
|
<em class="property">class </em><tt class="descclassname">django_select2.fields.</tt><tt class="descname">HeavySelect2FieldBaseMixin</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/django_select2/fields.html#HeavySelect2FieldBaseMixin"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django_select2.fields.HeavySelect2FieldBaseMixin" 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>Base mixin field for all Heavy fields.</p>
|
|
<div class="admonition note">
|
|
<p class="first admonition-title">Note</p>
|
|
<p>Although Heavy fields accept <tt class="docutils literal"><span class="pre">choices</span></tt> parameter like all Django choice fields, but these
|
|
fields are backed by big data sources, so <tt class="docutils literal"><span class="pre">choices</span></tt> cannot possibly have all the values.</p>
|
|
<p class="last">For Heavies, consider <tt class="docutils literal"><span class="pre">choices</span></tt> to be a subset of all possible choices. It is available because users
|
|
might expect it to be available.</p>
|
|
</div>
|
|
<dl class="method">
|
|
<dt id="django_select2.fields.HeavySelect2FieldBaseMixin.__init__">
|
|
<tt class="descname">__init__</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/django_select2/fields.html#HeavySelect2FieldBaseMixin.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django_select2.fields.HeavySelect2FieldBaseMixin.__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> (<a class="reference external" href="https://docs.djangoproject.com/en/1.4/ref/class-based-views/#django.views.generic.base.View" title="(in Django v1.4.1)"><tt class="xref py py-class docutils literal"><span class="pre">django.views.generic.base.View</span></tt></a> or None) – 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’s Ajax queries.</li>
|
|
<li><strong>widget</strong> (<a class="reference external" href="https://docs.djangoproject.com/en/1.4/ref/forms/widgets/#django.forms.Widget" title="(in Django v1.4.1)"><tt class="xref py py-class docutils literal"><span class="pre">django.forms.widgets.Widget</span></tt></a> or None) – 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.HeavyChoiceField">
|
|
<em class="property">class </em><tt class="descclassname">django_select2.fields.</tt><tt class="descname">HeavyChoiceField</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/django_select2/fields.html#HeavyChoiceField"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django_select2.fields.HeavyChoiceField" 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>, <a class="reference external" href="https://docs.djangoproject.com/en/1.4/ref/forms/fields/#django.forms.Field" title="(in Django v1.4.1)"><tt class="xref py py-class docutils literal"><span class="pre">django.forms.fields.Field</span></tt></a></p>
|
|
<p>Reimplements <a class="reference external" href="https://docs.djangoproject.com/en/1.4/ref/forms/fields/#django.forms.TypedChoiceField" title="(in Django v1.4.1)"><tt class="xref py py-class docutils literal"><span class="pre">django.forms.TypedChoiceField</span></tt></a> in a way which suites the use of big data.</p>
|
|
<div class="admonition note">
|
|
<p class="first admonition-title">Note</p>
|
|
<p class="last">Although this field accepts <tt class="docutils literal"><span class="pre">choices</span></tt> parameter like all Django choice fields, but these
|
|
fields are backed by big data sources, so <tt class="docutils literal"><span class="pre">choices</span></tt> cannot possibly have all the values. It is meant
|
|
to be a subset of all possible choices.</p>
|
|
</div>
|
|
<dl class="attribute">
|
|
<dt id="django_select2.fields.HeavyChoiceField.empty_value">
|
|
<tt class="descname">empty_value</tt><em class="property"> = u''</em><a class="headerlink" href="#django_select2.fields.HeavyChoiceField.empty_value" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Sub-classes can set this other value if needed.</p>
|
|
</dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="django_select2.fields.HeavyChoiceField.coerce_value">
|
|
<tt class="descname">coerce_value</tt><big>(</big><em>value</em><big>)</big><a class="reference internal" href="_modules/django_select2/fields.html#HeavyChoiceField.coerce_value"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django_select2.fields.HeavyChoiceField.coerce_value" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Coerces <tt class="docutils literal"><span class="pre">value</span></tt> to a Python data type.</p>
|
|
<p>Sub-classes should override this if they do not want unicode values.</p>
|
|
</dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="django_select2.fields.HeavyChoiceField.validate_value">
|
|
<tt class="descname">validate_value</tt><big>(</big><em>value</em><big>)</big><a class="reference internal" href="_modules/django_select2/fields.html#HeavyChoiceField.validate_value"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django_select2.fields.HeavyChoiceField.validate_value" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Sub-classes can override this to validate the value entered against the big data.</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>value</strong> (As coerced by <a class="reference internal" href="#django_select2.fields.HeavyChoiceField.coerce_value" title="django_select2.fields.HeavyChoiceField.coerce_value"><tt class="xref py py-meth docutils literal"><span class="pre">coerce_value()</span></tt></a>.) – Value entered by the user.</td>
|
|
</tr>
|
|
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><tt class="docutils literal"><span class="pre">True</span></tt> means the <tt class="docutils literal"><span class="pre">value</span></tt> is valid.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="django_select2.fields.HeavyChoiceField.get_val_txt">
|
|
<tt class="descname">get_val_txt</tt><big>(</big><em>value</em><big>)</big><a class="reference internal" href="_modules/django_select2/fields.html#HeavyChoiceField.get_val_txt"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django_select2.fields.HeavyChoiceField.get_val_txt" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>If Heavy widgets encounter any value which it can’t find in <tt class="docutils literal"><span class="pre">choices</span></tt> then it calls
|
|
this method to get the label for the value.</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>value</strong> (As coerced by <a class="reference internal" href="#django_select2.fields.HeavyChoiceField.coerce_value" title="django_select2.fields.HeavyChoiceField.coerce_value"><tt class="xref py py-meth docutils literal"><span class="pre">coerce_value()</span></tt></a>.) – Value entered by the user.</td>
|
|
</tr>
|
|
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">The label for this value.</td>
|
|
</tr>
|
|
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="http://docs.python.org/2.7/library/functions.html#unicode" title="(in Python v2.7)"><tt class="xref py py-obj docutils literal"><span class="pre">unicode</span></tt></a> or None (when no possible label could be found)</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</dd></dl>
|
|
|
|
</dd></dl>
|
|
|
|
<dl class="class">
|
|
<dt id="django_select2.fields.HeavyMultipleChoiceField">
|
|
<em class="property">class </em><tt class="descclassname">django_select2.fields.</tt><tt class="descname">HeavyMultipleChoiceField</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/django_select2/fields.html#HeavyMultipleChoiceField"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django_select2.fields.HeavyMultipleChoiceField" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Bases: <a class="reference internal" href="#django_select2.fields.HeavyChoiceField" title="django_select2.fields.HeavyChoiceField"><tt class="xref py py-class docutils literal"><span class="pre">django_select2.fields.HeavyChoiceField</span></tt></a></p>
|
|
<p>Reimplements <a class="reference external" href="https://docs.djangoproject.com/en/1.4/ref/forms/fields/#django.forms.TypedMultipleChoiceField" title="(in Django v1.4.1)"><tt class="xref py py-class docutils literal"><span class="pre">django.forms.TypedMultipleChoiceField</span></tt></a> in a way which suites the use of big data.</p>
|
|
<div class="admonition note">
|
|
<p class="first admonition-title">Note</p>
|
|
<p class="last">Although this field accepts <tt class="docutils literal"><span class="pre">choices</span></tt> parameter like all Django choice fields, but these
|
|
fields are backed by big data sources, so <tt class="docutils literal"><span class="pre">choices</span></tt> cannot possibly have all the values. It is meant
|
|
to be a subset of all possible choices.</p>
|
|
</div>
|
|
<dl class="attribute">
|
|
<dt id="django_select2.fields.HeavyMultipleChoiceField.hidden_widget">
|
|
<tt class="descname">hidden_widget</tt><a class="headerlink" href="#django_select2.fields.HeavyMultipleChoiceField.hidden_widget" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">MultipleHiddenInput</span></tt></p>
|
|
</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="reference internal" href="_modules/django_select2/fields.html#HeavySelect2ChoiceField"><span class="viewcode-link">[source]</span></a><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.HeavySelect2FieldBaseMixin" title="django_select2.fields.HeavySelect2FieldBaseMixin"><tt class="xref py py-class docutils literal"><span class="pre">django_select2.fields.HeavySelect2FieldBaseMixin</span></tt></a>, <a class="reference internal" href="#django_select2.fields.HeavyChoiceField" title="django_select2.fields.HeavyChoiceField"><tt class="xref py py-class docutils literal"><span class="pre">django_select2.fields.HeavyChoiceField</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="reference internal" href="_modules/django_select2/fields.html#HeavySelect2MultipleChoiceField"><span class="viewcode-link">[source]</span></a><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.HeavySelect2FieldBaseMixin" title="django_select2.fields.HeavySelect2FieldBaseMixin"><tt class="xref py py-class docutils literal"><span class="pre">django_select2.fields.HeavySelect2FieldBaseMixin</span></tt></a>, <a class="reference internal" href="#django_select2.fields.HeavyMultipleChoiceField" title="django_select2.fields.HeavyMultipleChoiceField"><tt class="xref py py-class docutils literal"><span class="pre">django_select2.fields.HeavyMultipleChoiceField</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="reference internal" href="_modules/django_select2/fields.html#HeavyModelSelect2ChoiceField"><span class="viewcode-link">[source]</span></a><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.HeavySelect2FieldBaseMixin" title="django_select2.fields.HeavySelect2FieldBaseMixin"><tt class="xref py py-class docutils literal"><span class="pre">django_select2.fields.HeavySelect2FieldBaseMixin</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>
|
|
<dl class="attribute">
|
|
<dt id="django_select2.fields.HeavyModelSelect2ChoiceField.widget">
|
|
<tt class="descname">widget</tt><a class="headerlink" href="#django_select2.fields.HeavyModelSelect2ChoiceField.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.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="reference internal" href="_modules/django_select2/fields.html#HeavyModelSelect2MultipleChoiceField"><span class="viewcode-link">[source]</span></a><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.HeavySelect2FieldBaseMixin" title="django_select2.fields.HeavySelect2FieldBaseMixin"><tt class="xref py py-class docutils literal"><span class="pre">django_select2.fields.HeavySelect2FieldBaseMixin</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>
|
|
<dl class="attribute">
|
|
<dt id="django_select2.fields.HeavyModelSelect2MultipleChoiceField.widget">
|
|
<tt class="descname">widget</tt><a class="headerlink" href="#django_select2.fields.HeavyModelSelect2MultipleChoiceField.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.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="reference internal" href="_modules/django_select2/fields.html#AutoSelect2Field"><span class="viewcode-link">[source]</span></a><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>
|
|
<div class="admonition warning">
|
|
<p class="first admonition-title">Warning</p>
|
|
<p class="last"><tt class="xref py py-exc docutils literal"><span class="pre">NotImplementedError</span></tt> would be thrown if <tt class="xref py py-meth docutils literal"><span class="pre">get_results()</span></tt> is not implemented.</p>
|
|
</div>
|
|
<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="reference internal" href="_modules/django_select2/fields.html#AutoSelect2MultipleField"><span class="viewcode-link">[source]</span></a><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>
|
|
<div class="admonition warning">
|
|
<p class="first admonition-title">Warning</p>
|
|
<p class="last"><tt class="xref py py-exc docutils literal"><span class="pre">NotImplementedError</span></tt> would be thrown if <tt class="xref py py-meth docutils literal"><span class="pre">get_results()</span></tt> is not implemented.</p>
|
|
</div>
|
|
<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="reference internal" href="_modules/django_select2/fields.html#AutoModelSelect2Field"><span class="viewcode-link">[source]</span></a><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="reference internal" href="_modules/django_select2/fields.html#AutoModelSelect2MultipleField"><span class="viewcode-link">[source]</span></a><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>
|
|
<div class="sphinxsidebar">
|
|
<div class="sphinxsidebarwrapper">
|
|
<h3><a href="index.html">Table Of Contents</a></h3>
|
|
<ul>
|
|
<li><a class="reference internal" href="#">Fields</a><ul>
|
|
<li><a class="reference internal" href="#class-diagrams">Class Diagrams</a></li>
|
|
<li><a class="reference internal" href="#module-django_select2.fields">Reference</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
|
|
<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.1 documentation</a> »</li>
|
|
<li><a href="reference.html" >API Reference</a> »</li>
|
|
</ul>
|
|
</div>
|
|
<div class="footer">
|
|
© Copyright 2012, Nirupam Biswas.
|
|
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
|
|
</div>
|
|
</body>
|
|
</html> |