Symptoms:
While using AutoModelSelect2Field in admin site, I noticed that css files are rendered only at the first request to the add or edit forms, after that the widget is rendered but without loading any css files from get_select2_css_libs.
Solution:
I changed assets loading from Assets as a static definition to Media as a dynamic property as described at Django docs:
https://docs.djangoproject.com/en/1.8/topics/forms/media/#media-as-a-dynamic-property
Closed #179
Squashed commit of the following:
commit f925ed4a118687b82b6f61d21a9104ccf00859c8
Author: Razi Alsayyed <razi.sayed@gmail.com>
Date: Fri Jun 19 01:39:47 2015 +0300
remove trailing whitespace from docstrings
commit b3f6553e422e19c8e065e026511c4ffd91ffee42
Author: Razi Alsayyed <razi.sayed@gmail.com>
Date: Fri Jun 19 01:35:15 2015 +0300
Remove blank lines from docstrings
commit 4490b78572a25069472933c88ebee48445b59972
Author: Razi Alsayyed <razi.sayed@gmail.com>
Date: Fri Jun 19 01:19:38 2015 +0300
construct Media the right way
Remove code that access private attributes of Media class.
commit 6697cd734daca62ff099be73d0685ce6af32e53d
Author: Razi Alsayyed <razi.sayed@gmail.com>
Date: Tue Jun 16 00:11:29 2015 +0300
fix
change _media to _get_media
I hope it is the final commit :)
commit 59bda01aed44e5658825a1bfe37ad09c5760a3ad
Author: Razi Alsayyed <razi.sayed@gmail.com>
Date: Tue Jun 16 00:09:35 2015 +0300
get_select2_heavy_js_libs
change get_select2_js_libs to get_select2_heavy_js_libs
commit 993e201355c9d5a6012e6f67cfa64462576c2570
Author: Razi Alsayyed <razi.sayed@gmail.com>
Date: Tue Jun 16 00:07:57 2015 +0300
fix
fix
commit f66e5f40b9f4df295bc5aaa7f2aafe588b2c41bb
Author: Razi Alsayyed <razi.sayed@gmail.com>
Date: Mon Jun 15 23:55:53 2015 +0300
fix
fix
commit d33d90278345bc32e80e20bdf782fd9ac5eb1800
Author: Razi Alsayyed <razi.sayed@gmail.com>
Date: Mon Jun 15 23:47:25 2015 +0300
fix
fix
commit f6d956149d2e99ee504c7b2c110f959f7472a181
Author: Razi Alsayyed <razi.sayed@gmail.com>
Date: Mon Jun 15 23:45:09 2015 +0300
fix
fix
commit 6d737a78cc07507c5b9b91736f6662b5f6f31c57
Author: Razi Alsayyed <razi.sayed@gmail.com>
Date: Mon Jun 15 23:40:01 2015 +0300
global name 'Media' is not defined
global name 'Media' is not defined
commit 661a817b092dc72bfa8df1a5458d474599c0a50e
Author: Razi Alsayyed <razi.sayed@gmail.com>
Date: Mon Jun 15 23:27:27 2015 +0300
Media as a dynamic property
**Symptoms:**
While using AutoModelSelect2Field in admin site, I noticed that css files are rendered only at the first request to the add or edit forms, after that the widget is rendered but without loading any css files from get_select2_css_libs.
**Solution:**
I changed assets loading from [Assets as a static definition](https://docs.djangoproject.com/en/1.8/topics/forms/media/#media-as-a-dynamic-property) to [Media as a dynamic property](https://docs.djangoproject.com/en/1.8/topics/forms/media/#media-as-a-dynamic-property) as described at Django docs.
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