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.1.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.1.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.1.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.1.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-60c0f4eeee4e5f3593cfeed497d273404a97aa93.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="node1" 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"/>
|
|
<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"/>
|
|
</map>
|
|
</p>
|
|
<p class="graphviz">
|
|
<img src="_images/inheritance-e8b9f4af689b0de54344072e7e0483be35ef403a.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="node1" 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="node11" 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-ee4358a11d433ca0ee7fba755e96f0e3e64dc4a2.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="node11" 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="node4" 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="node5" 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-1914418b1c10c8c495484ce6bfb897f7906b0db1.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.ChoiceMixin" title="ChoiceMixin" alt="" coords="408,23,405,17,395,13,381,9,362,7,341,6,321,7,302,9,287,13,278,17,274,23,278,28,287,33,302,36,321,39,341,40,362,39,381,36,395,33,405,28"/>
|
|
<area shape="poly" id="node9" href="#django_select2.fields.HeavyChoiceField" title="HeavyChoiceField" alt="" coords="496,105,492,100,479,95,458,92,433,89,404,88,375,89,350,92,329,95,316,100,312,105,316,111,329,115,350,119,375,121,404,122,433,121,458,119,479,115,492,111"/>
|
|
<area shape="poly" id="node2" href="#django_select2.fields.HeavySelect2MultipleChoiceField" title="HeavySelect2MultipleChoiceField" alt="" coords="323,271,316,265,293,261,258,257,213,255,164,254,115,255,70,257,35,261,12,265,5,271,12,276,35,281,70,284,115,287,164,288,213,287,258,284,293,281,316,276"/>
|
|
<area shape="poly" id="node12" href="#django_select2.fields.AutoSelect2MultipleField" title="AutoSelect2MultipleField" alt="" coords="434,353,428,348,411,343,383,340,349,337,311,336,273,337,238,340,211,343,193,348,187,353,193,359,211,363,238,367,273,369,311,370,349,369,383,367,411,363,428,359"/>
|
|
<area shape="poly" id="node3" href="#django_select2.fields.HeavySelect2FieldBaseMixin" title="HeavySelect2FieldBaseMixin" alt="" coords="632,188,625,183,605,178,575,174,536,172,493,171,451,172,412,174,381,178,362,183,355,188,362,193,381,198,412,202,451,204,493,205,536,204,575,202,605,198,625,193"/>
|
|
<area shape="poly" id="node7" href="#django_select2.fields.HeavySelect2ChoiceField" title="HeavySelect2ChoiceField" alt="" coords="819,271,813,265,795,261,767,257,732,255,693,254,655,255,620,257,592,261,574,265,568,271,574,276,592,281,620,284,655,287,693,288,732,287,767,284,795,281,813,276"/>
|
|
<area shape="poly" id="node5" href="#django_select2.fields.HeavyMultipleChoiceField" title="HeavyMultipleChoiceField" alt="" coords="298,188,292,183,274,178,246,174,211,172,172,171,133,172,98,174,70,178,52,183,46,188,52,193,70,198,98,202,133,204,172,205,211,204,246,202,274,198,292,193"/>
|
|
<area shape="poly" id="node16" href="#django_select2.fields.AutoSelect2Field" title="AutoSelect2Field" alt="" coords="659,353,655,348,642,343,622,340,597,337,569,336,542,337,517,340,497,343,484,348,480,353,484,359,497,363,517,367,542,369,569,370,597,369,622,367,642,363,655,359"/>
|
|
<area shape="poly" id="node13" href="#django_select2.fields.AutoViewFieldMixin" title="AutoViewFieldMixin" alt="" coords="543,271,539,265,525,261,503,257,476,255,445,254,415,255,388,257,366,261,352,265,347,271,352,276,366,281,388,284,415,287,445,288,476,287,503,284,525,281,539,276"/>
|
|
</map>
|
|
</p>
|
|
<p class="graphviz">
|
|
<img src="_images/inheritance-40875bc11940c51ab1e2c2bb4743594a8cb3b7f5.png" alt="Inheritance diagram of django_select2.fields.AutoModelSelect2Field" usemap="#inheritance0bde21cdb9" class="inheritance"/>
|
|
<map id="inheritance0bde21cdb9" name="inheritance0bde21cdb9">
|
|
<area shape="poly" id="node1" href="#django_select2.fields.AutoModelSelect2Field" title="AutoModelSelect2Field" alt="" coords="463,353,457,348,440,343,415,340,383,337,347,336,311,337,279,340,253,343,236,348,231,353,236,359,253,363,279,367,311,369,347,370,383,369,415,367,440,363,457,359"/>
|
|
<area shape="poly" id="node2" href="#django_select2.fields.ModelResultJsonMixin" title="ModelResultJsonMixin" alt="" coords="224,271,219,265,203,261,179,257,148,255,115,254,81,255,50,257,26,261,11,265,5,271,11,276,26,281,50,284,81,287,115,288,148,287,179,284,203,281,219,276"/>
|
|
<area shape="poly" id="node4" href="#django_select2.fields.AutoViewFieldMixin" title="AutoViewFieldMixin" alt="" coords="445,271,440,265,426,261,404,257,377,255,347,254,316,255,289,257,267,261,253,265,249,271,253,276,267,281,289,284,316,287,347,288,377,287,404,284,426,281,440,276"/>
|
|
<area shape="poly" id="node6" 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="node9" 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-efcf173f3fa00a38180d7c5ef406fe6ffd796e0c.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.HeavyModelSelect2MultipleChoiceField" title="HeavyModelSelect2MultipleChoiceField" alt="" coords="840,353,831,348,805,343,764,340,712,337,655,336,597,337,545,340,504,343,478,348,469,353,478,359,504,363,545,367,597,369,655,370,712,369,764,367,805,363,831,359"/>
|
|
<area shape="poly" id="node10" href="#django_select2.fields.AutoModelSelect2MultipleField" title="AutoModelSelect2MultipleField" alt="" coords="497,436,489,431,468,426,435,422,393,420,347,419,300,420,259,422,225,426,204,431,197,436,204,441,225,446,259,450,300,452,347,453,393,452,435,450,468,446,489,441"/>
|
|
<area shape="poly" id="node5" href="#django_select2.fields.HeavySelect2FieldBaseMixin" title="HeavySelect2FieldBaseMixin" alt="" coords="648,271,641,265,621,261,591,257,552,255,509,254,467,255,428,257,397,261,378,265,371,271,378,276,397,281,428,284,467,287,509,288,552,287,591,284,621,281,641,276"/>
|
|
<area shape="poly" id="node11" href="#django_select2.fields.ModelResultJsonMixin" title="ModelResultJsonMixin" alt="" coords="224,353,219,348,203,343,179,340,148,337,115,336,81,337,50,340,26,343,11,348,5,353,11,359,26,363,50,367,81,369,115,370,148,369,179,367,203,363,219,359"/>
|
|
<area shape="poly" id="node13" href="#django_select2.fields.AutoViewFieldMixin" title="AutoViewFieldMixin" alt="" coords="445,353,440,348,426,343,404,340,377,337,347,336,316,337,289,340,267,343,253,348,249,353,253,359,267,363,289,367,316,369,347,370,377,369,404,367,426,363,440,359"/>
|
|
</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.1.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> |