Mark Lavin  committed a038570

Adding documentation on using django-selectable with dynamically added forms. Fixes #31.

  • Participants
  • Parent commits 6330cef
  • Branches default

Comments (0)

Files changed (3)

File docs/admin.rst

 on `overriding the default widgets <>`_. As you will see integrating Django-Selectables in the admin
 is the same as working with regular forms.
+.. _admin-jquery-include:
 Including jQuery & jQuery UI

File docs/advanced.rst

 .. _chain-select-example:
-Chained Selection Example
+Chained Selection
 It's a fairly common pattern to have two or more inputs depend one another such City/State/Zip.
 detail you should refer to the `jQuery UI docs on these events <>`_.
-Submit On Selection Example
+Submit On Selection
 You might want to help your users by submitting the form once they have selected a valid
+Dynamically Added Forms
+django-selectable can work with dynamically added forms such as inlines in the admin.
+To make django-selectable work in the admin there is nothing more to do than include
+the necessary static media as described in the 
+:ref:`Admin Integration <admin-jquery-include>` section.
+If you are making use of the popular `django-dynamic-formset <>`_
+then you can make django-selectable work by passing ``bindSelectables`` to the 
+`added <>`_ option:
+    .. code-block:: html
+        <script type="text/javascript">
+            $(document).ready(function() {
+                $('#my-formset').formset({
+               		added: bindSelectables	
+                });
+            });
+        </script>
+Currently you must include the django-selectable javascript below this formset initialization
+code for this to work. See django-selectable `issue #31 <>`_
+for some additional detail on this problem.

File example/templates/admin/base_site.html

 {% extends "admin/base.html" %}
 {% block title %}{{ title }} | Django-Selectable Example Site{% endblock title %}
 {% block extrahead %}
-<link rel="stylesheet" href="" type="text/css" media="screen">
-<script type="text/javascript" src=""></script>
-<script type="text/javascript" src=""></script>
+<link rel="stylesheet" href="//" type="text/css" />
+<script type="text/javascript" src="//"></script>
+<script type="text/javascript" src="//"></script>
 {% endblock %}
 {% block branding %}
 <h1 id="site-name">Django-Selectable Administration</h1>