* 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
Code to generate JS code did not take into account the scenario where
string constants already had quotes in them. Only Heavy fields and
widgets were affected.