Both mixins implemented almost an identical functionaly and both called super.
That caused AutoHeavySelect2Mixin to call the wrong super class and executed wrong js code.
Squashed commit of the following:
commit 2544866077707f068ab2c411a1dbcea4e3ec47e8
Author: Dylan Verheul <dylan@zostera.nl>
Date: Thu Dec 12 13:16:22 2013 +0100
Proper fixing of #81 and #82
commit 8e640a874d96171befae023c8d7c1dcb43e2bd6d
Author: Dylan Verheul <dylan@zostera.nl>
Date: Thu Dec 12 11:50:43 2013 +0100
Move testing of RENDER_SELECT2_STATICS to Media class, fixes#81
with django 1.7, is hidden in no loger an attribute
but a property which compare input_type with "hidden"
this commit make sur that is_hidden will always be False
can be merged in 4.2.2
Add a test for HeavyModelSelect2TagField in the testapp.
The labels for selected options aren't displayed correctly in the test.
I updated HeavySelect2TagWidget to override render_inner_js_code, and now it seems to work properly.
Closes#133
Squashed commit of the following:
commit 94895a8743b0c4ebdf888da08827486106a5b15d
Author: Ben Cail <benjamin_cail@brown.edu>
Date: Tue Nov 18 15:11:24 2014 -0500
use view name instead of hard-coded url
commit fb9e1444ed73f2c8bad071182e8919dbf4f6bfe6
Author: Ben Cail <benjamin_cail@brown.edu>
Date: Mon Nov 17 14:31:50 2014 -0500
override render_inner_js_code in HeavySelect2TagWidget (similar to AutoHeavySelect2Mixin)
commit feff9c2a76474121aa2ff9c9b98a4f7dbfb0ab49
Author: Ben Cail <benjamin_cail@brown.edu>
Date: Mon Nov 17 14:21:29 2014 -0500
add test for HeavyModelSelect2TagField
* 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
I have just been bitten by this.
While it's really related to select2, due to the fact that django-select2 adds his bits of abstraction on top of select2, I wasted quite some time making sure nothing was wrong with django-select2 in the first place...
Hope it can help others, or help me if I happen to forget about it ;)