django-select2/django_select2
Thomas Schreiber 36bac0570f Support dynamic inline formsets w/ select2 fields.
* Previously, when using {{ form.empty_form }} the inline js would
    automatically be called on the `empty_form`. This made it impossible
    to dynamically add inlines to the page because of how
    `__prefix__` is duplicated to the new inlines.

    This commit wraps all the inline js in a function which is attached
    to global `window.django_select2` plugin. On page load only non
    `empty_form`'s are initialized with select2, giving the developer to
    attach to the 'add new inline' click and call the `django_select2`
    plugin with the proper inline formset id. I am using this now with
    `django-superformset` and dynamically inserted inlines that contain
    select2 fields are working as expected.

    Additionally all the inline js for each formset is identicaly, a
    future cleanup could be to only inline the field and form id
    variables.

  * First converted `widgets.py` to Unix file type so the diff does not
    contain windows line endings.

  * Since all the inline js is now run post page load, we can put all of
    the`django_select2` js libraries at the page bottom with other js assets.
    refs #51

  * As a bonus, this removes all the js code generation libs from utils with
    json.dumps().

  * I have not tried formsets with the django admin, however this work
    will allow inline formsets support to be added to the admin with
    less developer effort than before.

Refs: #125, #65, #49, #32, #109
2014-09-11 22:58:17 +02:00
..
static Add django_select2 to the global space. 2014-09-11 22:55:04 +02:00
templatetags v3.3.1 commit 2013-03-13 00:29:02 +05:30
__init__.py update capitalization of proper nouns 2013-11-19 19:09:19 -06:00
db_client.py * Multi-process support. * Updated Select2 to 3.3.1. 2013-03-02 11:25:00 +05:30
fields.py Merge pull request #114 from fjcapdevila/master 2014-06-11 02:16:34 +05:30
memcache_client.py * Multi-process support. * Updated Select2 to 3.3.1. 2013-03-02 11:25:00 +05:30
memcache_wrapped_db_client.py * Multi-process support. * Updated Select2 to 3.3.1. 2013-03-02 11:25:00 +05:30
models.py * Multi-process support. * Updated Select2 to 3.3.1. 2013-03-02 11:25:00 +05:30
urls.py Do not import urls defaults 2013-03-27 12:14:45 +08:00
util.py Support dynamic inline formsets w/ select2 fields. 2014-09-11 22:58:17 +02:00
views.py Fix another typo 2014-06-09 18:15:31 -03:00
widgets.py Support dynamic inline formsets w/ select2 fields. 2014-09-11 22:58:17 +02:00