mirror of
https://github.com/Hopiu/django-select2.git
synced 2026-03-19 23:00:24 +00:00
601 lines
No EOL
50 KiB
HTML
601 lines
No EOL
50 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>Widgets — Django-Select2 3.1.2 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.2',
|
|
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.2 documentation" href="index.html" />
|
|
<link rel="up" title="API Reference" href="reference.html" />
|
|
<link rel="next" title="Fields" href="ref_fields.html" />
|
|
<link rel="prev" title="API Reference" href="reference.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_fields.html" title="Fields"
|
|
accesskey="N">next</a> |</li>
|
|
<li class="right" >
|
|
<a href="reference.html" title="API Reference"
|
|
accesskey="P">previous</a> |</li>
|
|
<li><a href="index.html">Django-Select2 3.1.2 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="widgets">
|
|
<h1>Widgets<a class="headerlink" href="#widgets" title="Permalink to this headline">¶</a></h1>
|
|
<div class="section" id="class-diagram">
|
|
<h2>Class Diagram<a class="headerlink" href="#class-diagram" title="Permalink to this headline">¶</a></h2>
|
|
<p class="graphviz">
|
|
<img src="_images/inheritance-13782e5f674c6b31f4c4c1b27e4a0349bdac7cc8.png" alt="Inheritance diagram of django_select2.widgets" usemap="#inheritancecdbd4d640c" class="inheritance"/>
|
|
<map id="inheritancecdbd4d640c" name="inheritancecdbd4d640c">
|
|
<area shape="poly" id="node1" href="#django_select2.widgets.AutoHeavySelect2MultipleWidget" title="AutoHeavySelect2MultipleWidget" alt="" coords="932,436,924,431,902,426,866,422,822,420,772,419,722,420,678,422,642,426,620,431,612,436,620,441,642,446,678,450,722,452,772,453,822,452,866,450,902,446,924,441"/>
|
|
<area shape="poly" id="node2" href="#django_select2.widgets.AutoHeavySelect2Mixin" title="AutoHeavySelect2Mixin" alt="" coords="664,353,658,348,641,343,615,340,583,337,547,336,511,337,478,340,452,343,435,348,430,353,435,359,452,363,478,367,511,369,547,370,583,369,615,367,641,363,658,359"/>
|
|
<area shape="poly" id="node25" href="#django_select2.widgets.AutoHeavySelect2Widget" title="AutoHeavySelect2Widget" alt="" coords="534,436,528,431,510,426,482,422,447,420,408,419,369,420,334,422,306,426,288,431,282,436,288,441,306,446,334,450,369,452,408,453,447,452,482,450,510,446,528,441"/>
|
|
<area shape="poly" id="node4" href="#django_select2.widgets.HeavySelect2MultipleWidget" title="HeavySelect2MultipleWidget" alt="" coords="966,353,959,348,940,343,909,340,870,337,827,336,784,337,745,340,714,343,694,348,687,353,694,359,714,363,745,367,784,369,827,370,870,369,909,367,940,363,959,359"/>
|
|
<area shape="poly" id="node6" href="#django_select2.widgets.MultipleSelect2HiddenInput" title="MultipleSelect2HiddenInput" alt="" coords="979,271,973,265,953,261,923,257,885,255,843,254,800,255,762,257,732,261,713,265,706,271,713,276,732,281,762,284,800,287,843,288,885,287,923,284,953,281,973,276"/>
|
|
<area shape="poly" id="node27" href="#django_select2.widgets.HeavySelect2Widget" title="HeavySelect2Widget" alt="" coords="406,353,400,348,385,343,362,340,333,337,300,336,267,337,238,340,215,343,200,348,194,353,200,359,215,363,238,367,267,369,300,370,333,369,362,367,385,363,400,359"/>
|
|
<area shape="poly" id="node9" href="#django_select2.widgets.Select2Widget" title="Select2Widget" alt="" coords="163,271,159,265,148,261,131,257,108,255,84,254,60,255,37,257,20,261,9,265,5,271,9,276,20,281,37,284,60,287,84,288,108,287,131,284,148,281,159,276"/>
|
|
<area shape="poly" id="node10" href="#django_select2.widgets.Select2Mixin" title="Select2Mixin" alt="" coords="354,188,350,183,340,178,325,174,306,172,284,171,262,172,243,174,228,178,218,183,214,188,218,193,228,198,243,202,262,204,284,205,306,204,325,202,340,198,350,193"/>
|
|
<area shape="poly" id="node21" href="#django_select2.widgets.HeavySelect2Mixin" title="HeavySelect2Mixin" alt="" coords="380,271,375,265,362,261,341,257,314,255,284,254,254,255,227,257,206,261,193,265,188,271,193,276,206,281,227,284,254,287,284,288,314,287,341,284,362,281,375,276"/>
|
|
<area shape="poly" id="node29" href="#django_select2.widgets.Select2MultipleWidget" title="Select2MultipleWidget" alt="" coords="630,271,625,265,609,261,584,257,552,255,517,254,482,255,451,257,426,261,410,265,404,271,410,276,426,281,451,284,482,287,517,288,552,287,584,284,609,281,625,276"/>
|
|
</map>
|
|
</p>
|
|
</div>
|
|
<div class="section" id="module-django_select2.widgets">
|
|
<span id="reference"></span><h2>Reference<a class="headerlink" href="#module-django_select2.widgets" title="Permalink to this headline">¶</a></h2>
|
|
<p>Contains all the Django widgets for Select2.</p>
|
|
<dl class="class">
|
|
<dt id="django_select2.widgets.Select2Mixin">
|
|
<em class="property">class </em><tt class="descclassname">django_select2.widgets.</tt><tt class="descname">Select2Mixin</tt><big>(</big><em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/django_select2/widgets.html#Select2Mixin"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django_select2.widgets.Select2Mixin" 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>The base mixin of all Select2 widgets.</p>
|
|
<p>This mixin is responsible for rendering the necessary Javascript and CSS codes which turns normal <tt class="docutils literal"><span class="pre"><select></span></tt>
|
|
markups into Select2 choice list.</p>
|
|
<p>The following Select2 otions are added by this mixin:-</p>
|
|
<blockquote>
|
|
<div><ul class="simple">
|
|
<li>minimumResultsForSearch: <tt class="docutils literal"><span class="pre">6</span></tt></li>
|
|
<li>placeholder: <tt class="docutils literal"><span class="pre">''</span></tt></li>
|
|
<li>allowClear: <tt class="docutils literal"><span class="pre">True</span></tt></li>
|
|
<li>multiple: <tt class="docutils literal"><span class="pre">False</span></tt></li>
|
|
<li>closeOnSelect: <tt class="docutils literal"><span class="pre">False</span></tt></li>
|
|
</ul>
|
|
</div></blockquote>
|
|
<div class="admonition note">
|
|
<p class="first admonition-title">Note</p>
|
|
<p class="last">Many of them would be removed by sub-classes depending on requirements.</p>
|
|
</div>
|
|
<dl class="method">
|
|
<dt id="django_select2.widgets.Select2Mixin.__init__">
|
|
<tt class="descname">__init__</tt><big>(</big><em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/django_select2/widgets.html#Select2Mixin.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django_select2.widgets.Select2Mixin.__init__" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Constructor of the class.</p>
|
|
<p>The following additional kwarg is allowed:-</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>select2_options</strong> (<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> or None) – <p>This is similar to standard Django way to pass extra attributes to widgets.
|
|
This is meant to override values of existing <a class="reference internal" href="#django_select2.widgets.Select2Mixin.options" title="django_select2.widgets.Select2Mixin.options"><tt class="xref py py-attr docutils literal"><span class="pre">options</span></tt></a>.</p>
|
|
<p>Example:</p>
|
|
<div class="highlight-python"><div class="highlight"><pre><span class="k">class</span> <span class="nc">MyForm</span><span class="p">(</span><span class="n">ModelForm</span><span class="p">):</span>
|
|
<span class="k">class</span> <span class="nc">Meta</span><span class="p">:</span>
|
|
<span class="n">model</span> <span class="o">=</span> <span class="n">MyModel</span>
|
|
<span class="n">widgets</span> <span class="o">=</span> <span class="p">{</span>
|
|
<span class="s">'name'</span><span class="p">:</span> <span class="n">Select2WidgetName</span><span class="p">(</span><span class="n">select2_options</span><span class="o">=</span><span class="p">{</span>
|
|
<span class="s">'minimumResultsForSearch'</span><span class="p">:</span> <span class="mi">10</span><span class="p">,</span>
|
|
<span class="s">'closeOnSelect'</span><span class="p">:</span> <span class="bp">True</span><span class="p">,</span>
|
|
<span class="p">})</span>
|
|
<span class="p">}</span>
|
|
</pre></div>
|
|
</div>
|
|
<div class="admonition tip">
|
|
<p class="first admonition-title">Tip</p>
|
|
<p>You cannot introduce new options using this. For that you should sub-class and overried
|
|
<a class="reference internal" href="#django_select2.widgets.Select2Mixin.init_options" title="django_select2.widgets.Select2Mixin.init_options"><tt class="xref py py-meth docutils literal"><span class="pre">init_options()</span></tt></a>. The reason for this is, few options are not compatible with each other
|
|
or are not applicable in some scenarios. For example, when Select2 is attached to <tt class="docutils literal"><span class="pre"><select></span></tt> tag,
|
|
it can get if it is multiple or single valued from that tag itself. In this case if you specify
|
|
<tt class="docutils literal"><span class="pre">multiple</span></tt> option then not only it is useless but an error in Select2 JS’ point of view.</p>
|
|
<p class="last">There are other such intricacies, based on which some options are removed. By enforcing this
|
|
restriction we make sure to not break the code by passing some wrong concotion of options.</p>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</dd></dl>
|
|
|
|
<dl class="attribute">
|
|
<dt id="django_select2.widgets.Select2Mixin.options">
|
|
<tt class="descname">options</tt><em class="property"> = {'minimumResultsForSearch': 6, 'allowClear': True, 'closeOnSelect': False, 'placeholder': '', 'multiple': False}</em><a class="headerlink" href="#django_select2.widgets.Select2Mixin.options" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>The options listed in this are rendered as JS map and passed to Select2 JS code.
|
|
The complete description of theses options are available in <a class="reference external" href="http://ivaynberg.github.com/select2/#documentation.">Select2</a> JS’ site.</p>
|
|
</dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="django_select2.widgets.Select2Mixin.init_options">
|
|
<tt class="descname">init_options</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/django_select2/widgets.html#Select2Mixin.init_options"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django_select2.widgets.Select2Mixin.init_options" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Sub-classes can use this to pass additional options to Select2 JS library.</p>
|
|
<p>Example:</p>
|
|
<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">init_options</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
|
<span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="p">[</span><span class="s">'createSearchChoice'</span><span class="p">]</span> <span class="o">=</span> <span class="n">JSFunction</span><span class="p">(</span><span class="s">'Your_js_function'</span><span class="p">)</span>
|
|
</pre></div>
|
|
</div>
|
|
<p>In the above example we are setting <tt class="docutils literal"><span class="pre">Your_js_function</span></tt> as Select2’s <tt class="docutils literal"><span class="pre">createSearchChoice</span></tt>
|
|
function.</p>
|
|
<div class="admonition tip">
|
|
<p class="first admonition-title">Tip</p>
|
|
<p class="last">If you want to run <tt class="docutils literal"><span class="pre">Your_js_function</span></tt> in the context of the Select2 DOM element,
|
|
i.e. <tt class="docutils literal"><span class="pre">this</span></tt> inside your JS function should point to the component instead of <tt class="docutils literal"><span class="pre">window</span></tt>, then
|
|
use <a class="reference internal" href="ref_util.html#django_select2.util.JSFunctionInContext" title="django_select2.util.JSFunctionInContext"><tt class="xref py py-class docutils literal"><span class="pre">JSFunctionInContext</span></tt></a> instead of <a class="reference internal" href="ref_util.html#django_select2.util.JSFunction" title="django_select2.util.JSFunction"><tt class="xref py py-class docutils literal"><span class="pre">JSFunction</span></tt></a>.</p>
|
|
</div>
|
|
</dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="django_select2.widgets.Select2Mixin.set_placeholder">
|
|
<tt class="descname">set_placeholder</tt><big>(</big><em>val</em><big>)</big><a class="reference internal" href="_modules/django_select2/widgets.html#Select2Mixin.set_placeholder"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django_select2.widgets.Select2Mixin.set_placeholder" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Placeholder is a value which Select2 JS library shows when nothing is selected. This should be string.</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">Returns:</th><td class="field-body">None</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="django_select2.widgets.Select2Mixin.get_options">
|
|
<tt class="descname">get_options</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/django_select2/widgets.html#Select2Mixin.get_options"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django_select2.widgets.Select2Mixin.get_options" title="Permalink to this definition">¶</a></dt>
|
|
<dd><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">Returns:</th><td class="field-body">Dictionary of options to be passed to Select2 JS.</td>
|
|
</tr>
|
|
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><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></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="django_select2.widgets.Select2Mixin.render_select2_options_code">
|
|
<tt class="descname">render_select2_options_code</tt><big>(</big><em>options</em>, <em>id_</em><big>)</big><a class="reference internal" href="_modules/django_select2/widgets.html#Select2Mixin.render_select2_options_code"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django_select2.widgets.Select2Mixin.render_select2_options_code" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Renders options for Select2 JS.</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">Returns:</th><td class="field-body">The rendered JS code.</td>
|
|
</tr>
|
|
<tr class="field-even 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.widgets.Select2Mixin.render_js_code">
|
|
<tt class="descname">render_js_code</tt><big>(</big><em>id_</em>, <em>*args</em><big>)</big><a class="reference internal" href="_modules/django_select2/widgets.html#Select2Mixin.render_js_code"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django_select2.widgets.Select2Mixin.render_js_code" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Renders the <tt class="docutils literal"><span class="pre"><script></span></tt> block which contains the JS code for this widget.</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">Returns:</th><td class="field-body">The rendered JS code enclosed inside <tt class="docutils literal"><span class="pre"><script></span></tt> block.</td>
|
|
</tr>
|
|
<tr class="field-even 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.widgets.Select2Mixin.render_inner_js_code">
|
|
<tt class="descname">render_inner_js_code</tt><big>(</big><em>id_</em>, <em>*args</em><big>)</big><a class="reference internal" href="_modules/django_select2/widgets.html#Select2Mixin.render_inner_js_code"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django_select2.widgets.Select2Mixin.render_inner_js_code" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Renders all the JS code required for this widget.</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">Returns:</th><td class="field-body">The rendered JS code which will be later enclosed inside <tt class="docutils literal"><span class="pre"><script></span></tt> block.</td>
|
|
</tr>
|
|
<tr class="field-even 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.widgets.Select2Mixin.render">
|
|
<tt class="descname">render</tt><big>(</big><em>name</em>, <em>value</em>, <em>attrs=None</em>, <em>choices=()</em><big>)</big><a class="reference internal" href="_modules/django_select2/widgets.html#Select2Mixin.render"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django_select2.widgets.Select2Mixin.render" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Renders this widget. Html and JS code blocks all are rendered by this.</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">Returns:</th><td class="field-body">The rendered markup.</td>
|
|
</tr>
|
|
<tr class="field-even 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>
|
|
|
|
</dd></dl>
|
|
|
|
<dl class="class">
|
|
<dt id="django_select2.widgets.Select2Widget">
|
|
<em class="property">class </em><tt class="descclassname">django_select2.widgets.</tt><tt class="descname">Select2Widget</tt><big>(</big><em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/django_select2/widgets.html#Select2Widget"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django_select2.widgets.Select2Widget" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Bases: <a class="reference internal" href="#django_select2.widgets.Select2Mixin" title="django_select2.widgets.Select2Mixin"><tt class="xref py py-class docutils literal"><span class="pre">django_select2.widgets.Select2Mixin</span></tt></a>, <a class="reference external" href="https://docs.djangoproject.com/en/1.4/ref/forms/widgets/#django.forms.Select" title="(in Django v1.4.1)"><tt class="xref py py-class docutils literal"><span class="pre">django.forms.widgets.Select</span></tt></a></p>
|
|
<p>Drop-in Select2 replacement for <tt class="xref py py-class docutils literal"><span class="pre">forms.Select</span></tt>.</p>
|
|
<p>Following Select2 option from <a class="reference internal" href="#django_select2.widgets.Select2Mixin.options" title="django_select2.widgets.Select2Mixin.options"><tt class="xref py py-attr docutils literal"><span class="pre">Select2Mixin.options</span></tt></a> is removed:-</p>
|
|
<blockquote>
|
|
<div><ul class="simple">
|
|
<li>multiple</li>
|
|
</ul>
|
|
</div></blockquote>
|
|
</dd></dl>
|
|
|
|
<dl class="class">
|
|
<dt id="django_select2.widgets.Select2MultipleWidget">
|
|
<em class="property">class </em><tt class="descclassname">django_select2.widgets.</tt><tt class="descname">Select2MultipleWidget</tt><big>(</big><em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/django_select2/widgets.html#Select2MultipleWidget"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django_select2.widgets.Select2MultipleWidget" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Bases: <a class="reference internal" href="#django_select2.widgets.Select2Mixin" title="django_select2.widgets.Select2Mixin"><tt class="xref py py-class docutils literal"><span class="pre">django_select2.widgets.Select2Mixin</span></tt></a>, <a class="reference external" href="https://docs.djangoproject.com/en/1.4/ref/forms/widgets/#django.forms.SelectMultiple" title="(in Django v1.4.1)"><tt class="xref py py-class docutils literal"><span class="pre">django.forms.widgets.SelectMultiple</span></tt></a></p>
|
|
<p>Drop-in Select2 replacement for <tt class="xref py py-class docutils literal"><span class="pre">forms.SelectMultiple</span></tt>.</p>
|
|
<p>Following Select2 options from <a class="reference internal" href="#django_select2.widgets.Select2Mixin.options" title="django_select2.widgets.Select2Mixin.options"><tt class="xref py py-attr docutils literal"><span class="pre">Select2Mixin.options</span></tt></a> are removed:-</p>
|
|
<blockquote>
|
|
<div><ul class="simple">
|
|
<li>multiple</li>
|
|
<li>allowClear</li>
|
|
<li>minimumResultsForSearch</li>
|
|
</ul>
|
|
</div></blockquote>
|
|
</dd></dl>
|
|
|
|
<dl class="class">
|
|
<dt id="django_select2.widgets.MultipleSelect2HiddenInput">
|
|
<em class="property">class </em><tt class="descclassname">django_select2.widgets.</tt><tt class="descname">MultipleSelect2HiddenInput</tt><big>(</big><em>attrs=None</em><big>)</big><a class="reference internal" href="_modules/django_select2/widgets.html#MultipleSelect2HiddenInput"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django_select2.widgets.MultipleSelect2HiddenInput" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Bases: <a class="reference external" href="https://docs.djangoproject.com/en/1.4/ref/forms/widgets/#django.forms.TextInput" title="(in Django v1.4.1)"><tt class="xref py py-class docutils literal"><span class="pre">django.forms.widgets.TextInput</span></tt></a></p>
|
|
<p>Multiple hidden input for Select2.</p>
|
|
<p>This is a specialized multiple Hidden Input widget. This includes a special
|
|
JS component which renders multiple Hidden Input boxes as there are values.
|
|
So, if user suppose chooses values 1, 4 and 9 then Select2 would would write them
|
|
to the primary hidden input. The JS component of this widget will read that value and
|
|
will render three more hidden input boxes each with values 1, 4 and 9 respectively.
|
|
They will all share the name of this field, and the name of the primary source
|
|
hidden input would be removed. This way, when submitted all the selected values
|
|
would be available as list.</p>
|
|
</dd></dl>
|
|
|
|
<dl class="class">
|
|
<dt id="django_select2.widgets.HeavySelect2Mixin">
|
|
<em class="property">class </em><tt class="descclassname">django_select2.widgets.</tt><tt class="descname">HeavySelect2Mixin</tt><big>(</big><em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/django_select2/widgets.html#HeavySelect2Mixin"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django_select2.widgets.HeavySelect2Mixin" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Bases: <a class="reference internal" href="#django_select2.widgets.Select2Mixin" title="django_select2.widgets.Select2Mixin"><tt class="xref py py-class docutils literal"><span class="pre">django_select2.widgets.Select2Mixin</span></tt></a></p>
|
|
<p>The base mixin of all Heavy Select2 widgets. It sub-classes <a class="reference internal" href="#django_select2.widgets.Select2Mixin" title="django_select2.widgets.Select2Mixin"><tt class="xref py py-class docutils literal"><span class="pre">Select2Mixin</span></tt></a>.</p>
|
|
<p>This mixin adds more Select2 options to <a class="reference internal" href="#django_select2.widgets.Select2Mixin.options" title="django_select2.widgets.Select2Mixin.options"><tt class="xref py py-attr docutils literal"><span class="pre">Select2Mixin.options</span></tt></a>. These are:-</p>
|
|
<blockquote>
|
|
<div><ul>
|
|
<li><p class="first">minimumInputLength: <tt class="docutils literal"><span class="pre">2</span></tt></p>
|
|
</li>
|
|
<li><p class="first">initSelection: <tt class="docutils literal"><span class="pre">JSFunction('django_select2.onInit')</span></tt></p>
|
|
</li>
|
|
<li><dl class="first docutils">
|
|
<dt>ajax:</dt>
|
|
<dd><ul class="first last simple">
|
|
<li>dataType: <tt class="docutils literal"><span class="pre">'json'</span></tt></li>
|
|
<li>quietMillis: <tt class="docutils literal"><span class="pre">100</span></tt></li>
|
|
<li>data: <tt class="docutils literal"><span class="pre">JSFunctionInContext('django_select2.get_url_params')</span></tt></li>
|
|
<li>results: <tt class="docutils literal"><span class="pre">JSFunctionInContext('django_select2.process_results')</span></tt></li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
</div></blockquote>
|
|
<div class="admonition tip">
|
|
<p class="first admonition-title">Tip</p>
|
|
<p class="last">You can override these options by passing <tt class="docutils literal"><span class="pre">select2_options</span></tt> kwarg to <a class="reference internal" href="#django_select2.widgets.HeavySelect2Mixin.__init__" title="django_select2.widgets.HeavySelect2Mixin.__init__"><tt class="xref py py-meth docutils literal"><span class="pre">__init__()</span></tt></a>.</p>
|
|
</div>
|
|
<dl class="method">
|
|
<dt id="django_select2.widgets.HeavySelect2Mixin.__init__">
|
|
<tt class="descname">__init__</tt><big>(</big><em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/django_select2/widgets.html#HeavySelect2Mixin.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django_select2.widgets.HeavySelect2Mixin.__init__" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Constructor of the class.</p>
|
|
<p>The following kwargs are allowed:-</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>data_url</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> or None) – Url which will respond to Ajax queries with JSON object.</li>
|
|
</ul>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<div class="admonition tip">
|
|
<p class="first admonition-title">Tip</p>
|
|
<p class="last">When <tt class="docutils literal"><span class="pre">data_view</span></tt> is provided then it is converted into Url using
|
|
<a class="reference external" href="https://docs.djangoproject.com/en/1.4/topics/http/urls/#django.core.urlresolvers.reverse" title="(in Django v1.4.1)"><tt class="xref py py-func docutils literal"><span class="pre">reverse()</span></tt></a>.</p>
|
|
</div>
|
|
<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">data_url</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>
|
|
<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>choices</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> or <a class="reference external" href="http://docs.python.org/2.7/library/functions.html#tuple" title="(in Python v2.7)"><tt class="xref py py-obj docutils literal"><span class="pre">tuple</span></tt></a>) – The list of available choices. If not provided then empty list is used instead. It
|
|
should be of the form – <tt class="docutils literal"><span class="pre">[(val1,</span> <span class="pre">'Label1'),</span> <span class="pre">(val2,</span> <span class="pre">'Label2'),</span> <span class="pre">...]</span></tt>.</li>
|
|
<li><strong>userGetValTextFuncName</strong> – <p>The name of the custom JS function which you want to use to convert
|
|
value to label.</p>
|
|
<p>In <tt class="docutils literal"><span class="pre">heavy_data.js</span></tt>, <tt class="docutils literal"><span class="pre">django_select2.getValText()</span></tt> employs the following logic to convert value
|
|
to label :-</p>
|
|
<blockquote>
|
|
<div>1. First check if the Select2 input field has <tt class="docutils literal"><span class="pre">txt</span></tt> attribute set along with <tt class="docutils literal"><span class="pre">value</span></tt>. If found
|
|
then use it.<p>2. Otherwise, check if user has provided any custom method for this. Then use that. If it returns a
|
|
label then use it.</p>
|
|
<p>3. Otherwise, check the cached results. When the user searches in the fields then all the returned
|
|
responses from server, which has the value and label mapping, are cached by <tt class="docutils literal"><span class="pre">heavy_data.js</span></tt>.</p>
|
|
<p>4. If we still do not have the label then check the cookies. When user selects some value then
|
|
<tt class="docutils literal"><span class="pre">heavy_data.js</span></tt> stores the selected values and their labels in the cookies. These are cleared
|
|
when browser is closed.</p>
|
|
</div></blockquote>
|
|
</li>
|
|
</ul>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="django_select2.widgets.HeavySelect2Mixin.render_texts">
|
|
<tt class="descname">render_texts</tt><big>(</big><em>selected_choices</em>, <em>choices</em><big>)</big><a class="reference internal" href="_modules/django_select2/widgets.html#HeavySelect2Mixin.render_texts"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django_select2.widgets.HeavySelect2Mixin.render_texts" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Renders a JS array with labels for the <tt class="docutils literal"><span class="pre">selected_choices</span></tt>.</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>selected_choices</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> or <a class="reference external" href="http://docs.python.org/2.7/library/functions.html#tuple" title="(in Python v2.7)"><tt class="xref py py-obj docutils literal"><span class="pre">tuple</span></tt></a>) – List of selected choices’ values.</li>
|
|
<li><strong>choices</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> or <a class="reference external" href="http://docs.python.org/2.7/library/functions.html#tuple" title="(in Python v2.7)"><tt class="xref py py-obj docutils literal"><span class="pre">tuple</span></tt></a>) – Extra choices, if any. This is a list of tuples. In each tuple, the first
|
|
item is the choice value and the second item is choice label.</li>
|
|
</ul>
|
|
</td>
|
|
</tr>
|
|
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The rendered JS array code.</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#unicode" title="(in Python v2.7)"><tt class="xref py py-obj docutils literal"><span class="pre">unicode</span></tt></a></p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="django_select2.widgets.HeavySelect2Mixin.render_texts_for_value">
|
|
<tt class="descname">render_texts_for_value</tt><big>(</big><em>id_</em>, <em>value</em>, <em>choices</em><big>)</big><a class="reference internal" href="_modules/django_select2/widgets.html#HeavySelect2Mixin.render_texts_for_value"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django_select2.widgets.HeavySelect2Mixin.render_texts_for_value" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Renders the JS code which sets the <tt class="docutils literal"><span class="pre">txt</span></tt> attribute on the field. It gets the array
|
|
of lables from <a class="reference internal" href="#django_select2.widgets.HeavySelect2Mixin.render_texts" title="django_select2.widgets.HeavySelect2Mixin.render_texts"><tt class="xref py py-meth docutils literal"><span class="pre">render_texts()</span></tt></a>.</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>id</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>) – Id of the field. This can be used to get reference of this field’s DOM in JS.</li>
|
|
<li><strong>value</strong> (<em>Any</em>) – Currently set value on the field.</li>
|
|
<li><strong>choices</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> or <a class="reference external" href="http://docs.python.org/2.7/library/functions.html#tuple" title="(in Python v2.7)"><tt class="xref py py-obj docutils literal"><span class="pre">tuple</span></tt></a>) – Extra choices, if any. This is a list of tuples. In each tuple, the first
|
|
item is the choice value and the second item is choice label.</li>
|
|
</ul>
|
|
</td>
|
|
</tr>
|
|
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">JS code which sets the <tt class="docutils literal"><span class="pre">txt</span></tt> attribute.</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#unicode" title="(in Python v2.7)"><tt class="xref py py-obj docutils literal"><span class="pre">unicode</span></tt></a></p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</dd></dl>
|
|
|
|
</dd></dl>
|
|
|
|
<dl class="class">
|
|
<dt id="django_select2.widgets.HeavySelect2Widget">
|
|
<em class="property">class </em><tt class="descclassname">django_select2.widgets.</tt><tt class="descname">HeavySelect2Widget</tt><big>(</big><em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/django_select2/widgets.html#HeavySelect2Widget"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django_select2.widgets.HeavySelect2Widget" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Bases: <a class="reference internal" href="#django_select2.widgets.HeavySelect2Mixin" title="django_select2.widgets.HeavySelect2Mixin"><tt class="xref py py-class docutils literal"><span class="pre">django_select2.widgets.HeavySelect2Mixin</span></tt></a>, <a class="reference external" href="https://docs.djangoproject.com/en/1.4/ref/forms/widgets/#django.forms.TextInput" title="(in Django v1.4.1)"><tt class="xref py py-class docutils literal"><span class="pre">django.forms.widgets.TextInput</span></tt></a></p>
|
|
<p>Single selection heavy widget.</p>
|
|
<p>Following Select2 option from <a class="reference internal" href="#django_select2.widgets.Select2Mixin.options" title="django_select2.widgets.Select2Mixin.options"><tt class="xref py py-attr docutils literal"><span class="pre">Select2Mixin.options</span></tt></a> is added or set:-</p>
|
|
<blockquote>
|
|
<div><ul class="simple">
|
|
<li>multiple: <tt class="docutils literal"><span class="pre">False</span></tt></li>
|
|
</ul>
|
|
</div></blockquote>
|
|
</dd></dl>
|
|
|
|
<dl class="class">
|
|
<dt id="django_select2.widgets.HeavySelect2MultipleWidget">
|
|
<em class="property">class </em><tt class="descclassname">django_select2.widgets.</tt><tt class="descname">HeavySelect2MultipleWidget</tt><big>(</big><em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/django_select2/widgets.html#HeavySelect2MultipleWidget"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django_select2.widgets.HeavySelect2MultipleWidget" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Bases: <a class="reference internal" href="#django_select2.widgets.HeavySelect2Mixin" title="django_select2.widgets.HeavySelect2Mixin"><tt class="xref py py-class docutils literal"><span class="pre">django_select2.widgets.HeavySelect2Mixin</span></tt></a>, <a class="reference internal" href="#django_select2.widgets.MultipleSelect2HiddenInput" title="django_select2.widgets.MultipleSelect2HiddenInput"><tt class="xref py py-class docutils literal"><span class="pre">django_select2.widgets.MultipleSelect2HiddenInput</span></tt></a></p>
|
|
<p>Multiple selection heavy widget.</p>
|
|
<p>Following Select2 options from <a class="reference internal" href="#django_select2.widgets.Select2Mixin.options" title="django_select2.widgets.Select2Mixin.options"><tt class="xref py py-attr docutils literal"><span class="pre">Select2Mixin.options</span></tt></a> are removed:-</p>
|
|
<blockquote>
|
|
<div><ul class="simple">
|
|
<li>allowClear</li>
|
|
<li>minimumResultsForSearch</li>
|
|
</ul>
|
|
</div></blockquote>
|
|
<p>Following Select2 options from <a class="reference internal" href="#django_select2.widgets.Select2Mixin.options" title="django_select2.widgets.Select2Mixin.options"><tt class="xref py py-attr docutils literal"><span class="pre">Select2Mixin.options</span></tt></a> are added or set:-</p>
|
|
<blockquote>
|
|
<div><ul class="simple">
|
|
<li>multiple: <tt class="docutils literal"><span class="pre">False</span></tt></li>
|
|
<li>separator: <tt class="docutils literal"><span class="pre">JSVar('django_select2.MULTISEPARATOR')</span></tt></li>
|
|
</ul>
|
|
</div></blockquote>
|
|
<dl class="method">
|
|
<dt id="django_select2.widgets.HeavySelect2MultipleWidget.render_texts_for_value">
|
|
<tt class="descname">render_texts_for_value</tt><big>(</big><em>id_</em>, <em>value</em>, <em>choices</em><big>)</big><a class="reference internal" href="_modules/django_select2/widgets.html#HeavySelect2MultipleWidget.render_texts_for_value"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django_select2.widgets.HeavySelect2MultipleWidget.render_texts_for_value" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Renders the JS code which sets the <tt class="docutils literal"><span class="pre">txt</span></tt> attribute on the field. It gets the array
|
|
of lables from <a class="reference internal" href="#django_select2.widgets.HeavySelect2Mixin.render_texts" title="django_select2.widgets.HeavySelect2Mixin.render_texts"><tt class="xref py py-meth docutils literal"><span class="pre">render_texts()</span></tt></a>.</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>id</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>) – Id of the field. This can be used to get reference of this field’s DOM in JS.</li>
|
|
<li><strong>value</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>) – <strong>List</strong> of currently set value on the field.</li>
|
|
<li><strong>choices</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> or <a class="reference external" href="http://docs.python.org/2.7/library/functions.html#tuple" title="(in Python v2.7)"><tt class="xref py py-obj docutils literal"><span class="pre">tuple</span></tt></a>) – Extra choices, if any. This is a list of tuples. In each tuple, the first
|
|
item is the choice value and the second item is choice label.</li>
|
|
</ul>
|
|
</td>
|
|
</tr>
|
|
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">JS code which sets the <tt class="docutils literal"><span class="pre">txt</span></tt> attribute.</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#unicode" title="(in Python v2.7)"><tt class="xref py py-obj docutils literal"><span class="pre">unicode</span></tt></a></p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</dd></dl>
|
|
|
|
</dd></dl>
|
|
|
|
<dl class="class">
|
|
<dt id="django_select2.widgets.AutoHeavySelect2Mixin">
|
|
<em class="property">class </em><tt class="descclassname">django_select2.widgets.</tt><tt class="descname">AutoHeavySelect2Mixin</tt><a class="reference internal" href="_modules/django_select2/widgets.html#AutoHeavySelect2Mixin"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django_select2.widgets.AutoHeavySelect2Mixin" 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>This mixin is needed for Auto heavy fields.</p>
|
|
<p>This mxin adds extra JS code to notify the field’s DOM object of the generated id. The generated id
|
|
is not the same as the <tt class="docutils literal"><span class="pre">id</span></tt> attribute of the field’s Html markup. This id is generated 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">register_field()</span></tt></a> when the Auto field is registered. The client side (DOM) sends this
|
|
id along with the Ajax request, so that the central view can identify which field should be used to
|
|
serve the request.</p>
|
|
</dd></dl>
|
|
|
|
<dl class="class">
|
|
<dt id="django_select2.widgets.AutoHeavySelect2Widget">
|
|
<em class="property">class </em><tt class="descclassname">django_select2.widgets.</tt><tt class="descname">AutoHeavySelect2Widget</tt><big>(</big><em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/django_select2/widgets.html#AutoHeavySelect2Widget"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django_select2.widgets.AutoHeavySelect2Widget" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Bases: <a class="reference internal" href="#django_select2.widgets.AutoHeavySelect2Mixin" title="django_select2.widgets.AutoHeavySelect2Mixin"><tt class="xref py py-class docutils literal"><span class="pre">django_select2.widgets.AutoHeavySelect2Mixin</span></tt></a>, <a class="reference internal" href="#django_select2.widgets.HeavySelect2Widget" title="django_select2.widgets.HeavySelect2Widget"><tt class="xref py py-class docutils literal"><span class="pre">django_select2.widgets.HeavySelect2Widget</span></tt></a></p>
|
|
<p>Auto version of <a class="reference internal" href="#django_select2.widgets.HeavySelect2Widget" title="django_select2.widgets.HeavySelect2Widget"><tt class="xref py py-class docutils literal"><span class="pre">HeavySelect2Widget</span></tt></a></p>
|
|
</dd></dl>
|
|
|
|
<dl class="class">
|
|
<dt id="django_select2.widgets.AutoHeavySelect2MultipleWidget">
|
|
<em class="property">class </em><tt class="descclassname">django_select2.widgets.</tt><tt class="descname">AutoHeavySelect2MultipleWidget</tt><big>(</big><em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/django_select2/widgets.html#AutoHeavySelect2MultipleWidget"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django_select2.widgets.AutoHeavySelect2MultipleWidget" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Bases: <a class="reference internal" href="#django_select2.widgets.AutoHeavySelect2Mixin" title="django_select2.widgets.AutoHeavySelect2Mixin"><tt class="xref py py-class docutils literal"><span class="pre">django_select2.widgets.AutoHeavySelect2Mixin</span></tt></a>, <a class="reference internal" href="#django_select2.widgets.HeavySelect2MultipleWidget" title="django_select2.widgets.HeavySelect2MultipleWidget"><tt class="xref py py-class docutils literal"><span class="pre">django_select2.widgets.HeavySelect2MultipleWidget</span></tt></a></p>
|
|
<p>Auto version of <a class="reference internal" href="#django_select2.widgets.HeavySelect2MultipleWidget" title="django_select2.widgets.HeavySelect2MultipleWidget"><tt class="xref py py-class docutils literal"><span class="pre">HeavySelect2MultipleWidget</span></tt></a></p>
|
|
</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="#">Widgets</a><ul>
|
|
<li><a class="reference internal" href="#class-diagram">Class Diagram</a></li>
|
|
<li><a class="reference internal" href="#module-django_select2.widgets">Reference</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
|
|
<h4>Previous topic</h4>
|
|
<p class="topless"><a href="reference.html"
|
|
title="previous chapter">API Reference</a></p>
|
|
<h4>Next topic</h4>
|
|
<p class="topless"><a href="ref_fields.html"
|
|
title="next chapter">Fields</a></p>
|
|
<h3>This Page</h3>
|
|
<ul class="this-page-menu">
|
|
<li><a href="_sources/ref_widgets.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_fields.html" title="Fields"
|
|
>next</a> |</li>
|
|
<li class="right" >
|
|
<a href="reference.html" title="API Reference"
|
|
>previous</a> |</li>
|
|
<li><a href="index.html">Django-Select2 3.1.2 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> |