Commit graph

140 commits

Author SHA1 Message Date
Quantum
5137c043ed Make static work with CachedStaticFilesStorage
`django.templatetags.static.static` doesn't return the hashed URL,
but `django.contrib.staticfiles.templatetags.staticfiles.static` does.
2015-08-26 16:38:26 -04:00
Anatoly Bubenkov
e829422a3f avoid deprecated force_unicode 2015-08-10 14:19:46 +02:00
Anatoly Bubenkov
91160484ac correct force to use unicode 2015-08-10 09:42:08 +02:00
Anatoly Bubenkov
d9c4a2cd5a Force unicode for widget choice labels 2015-08-10 09:39:02 +02:00
Razi Alsayyed
b576bcdd9e Made widget media 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 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.
2015-06-19 14:49:51 +02:00
Daniel Hahler
de37752ac6 doc: fix typos/grammar 2015-06-08 11:35:09 +02:00
Eugene Morozov
8cc2253a5b Support proper translation of placeholders using ugettext_lazy. 2015-06-08 14:51:03 +06:00
Quantum
b5a154d425 Fix HeavySelect2MultipleWidget
"selector not found" error similar to 2bf42c5bda.

Closed #174
2015-06-01 10:22:49 +01:00
Sergey Fursov
bfee65fc95 return list of css links instead of generator 2015-05-05 15:59:16 +03:00
Nirupam Biswas
5f9477b664 Version 4.3.1 2015-04-29 01:14:11 +05:30
Sergey Fursov
c7101223f8 updated minified versions of static files 2015-04-28 19:53:05 +03:00
Nirupam Biswas
a57cb59436 Fixing setup.py and releasing 4.3.0. 2015-04-27 22:19:15 +05:30
Ben Cail
2bf42c5bda fix HeavySelect2Widget (with automated test) 2015-04-20 15:31:04 -04:00
Jonathan Senecal
1419dd9121 Fix selector is not defined javascript error
Closed #167
2015-04-13 18:45:35 +02:00
Jonathan Senecal
439852102b Updated select2.js to 3.5.2 2015-04-13 18:45:25 +02:00
Johannes Hoppe
cc9ded6fdc Fixed #103 -- Fixed inheritance issue
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.
2015-04-10 11:10:42 +02:00
Johannes Hoppe
d988cc683e Removed method check because it done by dispatch 2015-04-10 10:16:01 +02:00
Johannes Hoppe
5d9b463f2e Added six for metaclasses 2015-04-10 10:15:20 +02:00
Johannes Hoppe
8377f31f2e Merge pull request #160 from superqwer/django18
Fixed django1.8 compatibility issues
2015-04-08 17:56:25 +02:00
Johannes Hoppe
3126434a8f Merge pull request #161 from bcail/master
Fixed Select2Mixin hashedSelector
2015-04-08 17:55:10 +02:00
Ben Cail
12b00c1084 define hashedSelector in Select2Mixin 2015-04-06 14:41:24 -04:00
superqwer
bedb4b3c24 django1.8 compatibility issues 2015-04-06 16:31:23 +03:00
superqwer
bd761ec197 relative import fix 2015-04-06 15:58:42 +03:00
Johannes Hoppe
42b73198b7 Fixed import order 2015-04-02 18:54:08 +02:00
Dylan Verheul
28c2d5649e Resolved #83 -- Refactored widget Media
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
2015-04-02 18:44:23 +02:00
Johannes Hoppe
32c1e1eb5b Merge pull request #156 from onysos/master
fix on 4.2.2 with django 1.7 : is_hidden = True
2015-03-31 15:25:02 +02:00
Johannes Hoppe
bd40acc761 Added six types and fixed setup 2015-03-31 10:22:03 +02:00
darius BERNARD
0e331d5e33 added unittest for bug #156 2015-03-30 17:00:37 +02:00
darius BERNARD
ea9ae1176e Merge remote-tracking branch 'upstream/master'
Conflicts:
	django_select2/widgets.py
2015-03-30 16:33:18 +02:00
darius BERNARD
8e5d988e89 fix on 4.2.2 with django 1.7 : is_hidden = True
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
2015-03-30 11:35:36 +02:00
Johannes Hoppe
2cfbfd3325 Code cleanup -- Added pep8 tests for package. 2015-03-30 10:19:37 +02:00
Ben Cail
91dad724fb Adds render_inner_js_code to HeavySelect2TagWidget
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
2015-02-24 10:15:13 +01:00
Evgenii Shchemelev
e8580ed23d removed unnecessary db request 2014-10-07 18:01:49 +06:00
Thomas Schreiber
c2abdbd63f do not replace dashes on the selector id variable 2014-09-13 16:12:21 +02:00
Thomas Schreiber
1b57be5cd5 do not replace dashes on the selector variable 2014-09-13 16:05:04 +02:00
Thomas Schreiber
8d76a61791 prevent dashes in javascript variable names 2014-09-13 15:16:20 +02:00
Thomas Schreiber
e0686628d7 add the hashed field_id to the 'data-select2-id' attr 2014-09-13 03:04:44 +02:00
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
Thomas Schreiber
a9df6ad390 convert to unix filetype
Conflicts:
	django_select2/widgets.py
2014-09-11 22:58:02 +02:00
Thomas Schreiber
a563c62d33 Add django_select2 to the global space.
When javascript output is wrapped django_select2 can not be found,
adding it to the window instead of a var fixes this:
https://django-pipeline.readthedocs.org/en/latest/configuration.html#wrapped-javascript-output
2014-09-11 22:55:04 +02:00
AppleGrew
4f8fbb5f93 Merge pull request #115 from fjcapdevila/master
Fix typos
2014-06-12 08:55:04 +05:30
fjcapdevila
fd87d86344 typo 2014-06-11 12:34:43 -03:00
fjcapdevila
c7561ecde1 Typo 2014-06-11 12:25:21 -03:00
fjcapdevila
73d9e6cb90 Typo 2014-06-11 12:16:48 -03:00
AppleGrew
3f968c1532 Merge pull request #114 from fjcapdevila/master
Minor changes in doc-strings
2014-06-11 02:16:34 +05:30
fjcapdevila
3b8ba099a3 Minor format typo 2014-06-10 12:43:59 -03:00
fjcapdevila
5004b79c85 Typo
Little type
2014-06-10 12:23:24 -03:00
AppleGrew
40b2b9dbfc Merge pull request #113 from fjcapdevila/master
Fix another typos
2014-06-10 11:00:12 +05:30
fjcapdevila
4edeff61af Fix another typo
FIx another typo in a doc-string
2014-06-09 18:15:31 -03:00
AppleGrew
89c4f07643 Merge pull request #111 from jdotjdot/master
added '.distinct()' to result query on ModelJsonMixin
2014-06-10 02:28:52 +05:30