django.core.exceptions.ImproperlyConfigured: Creating a ModelForm without either the 'fields' attribute or the 'exclude' attribute is prohibited; form SchoolForm needs updating.
- Added the "fields" attribute to SchoolForm
- Added the "fields" attribute to EmployeeForm
- Added the "fields" attribute to DeptForm
- Added the "fields" attribute to QuestionForm
- Added the "fields" attribute to QuestionNonAutoForm
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.
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