Commit graph

50 commits

Author SHA1 Message Date
Bill Yeh
aef27f48df Add option to exclude the Select2 library from form media (#484) 2018-06-30 14:58:47 +02:00
Johannes Hoppe
f31beec0c4
Add support for custom to_field names for foreign keys (#486)
Django's ForeignKey supports custom to_fields. The to field is the
primary key by default, but can be modified. The to field is also
used by forms to reduce database lookups.

This patch add support for custom to_field names on both model or
form layer.
2018-06-30 14:56:32 +02:00
dzhuang
496cc7c502 Fallback i18n js files for zh-hans/zh-hant. (#468)
* Fallback i18n js files for zh-hans/zh-hant.

* Use Django admin's built-in SELECT2_TRANSLATIONS to determine the lang of i18n js files.
2018-06-14 11:49:47 +02:00
Jan Pieter Waagmeester
17af750d88 Link to stable Django version docs not 1.8 (#480) 2018-05-31 09:30:22 +02:00
Johannes Hoppe
d9c899e8f7 Resolve pickle security note 2018-05-07 18:52:17 +02:00
Jan Pieter Waagmeester
2ea6ef8edb Fix typo in docstring ChoicesField -> ChoiceField (#472)
It's `django.forms.ChoiceField`, not `django.forms.ChoicesField`.

Used correctly here: 
a9aa31146f/django_select2/forms.py (L143)
2018-05-06 13:02:38 +02:00
Sergey Fedoseev
a9aa31146f Fixed display of ModelSelect2Mixin.filter_queryset() doc. (#470) 2018-03-24 14:25:42 +01:00
Johannes Hoppe
f6d5afe51d Add support for Django 2.0 2017-11-25 18:56:46 +01:00
Johannes Hoppe
19e2e50921 Drop Django 1.8 and 1.10 support 2017-11-25 18:56:46 +01:00
Johannes Hoppe
f967eb643b Drop Python 2 support 2017-11-25 18:56:46 +01:00
Johannes Hoppe
90028d9e36 Fix case issue -- get_langauge() only returns lower case
get_langauge() only returns lower case some i18n file name include
upper case language code tho. This will detect all lanugages.
2017-07-24 10:25:56 +02:00
Johannes Hoppe
b46f69f166 Add i18n support 2017-07-16 17:30:42 +02:00
Yuval Adam
018701680b Update ArrayField tagging widget documentation
This change reflects the new widget rendering APIs in Django 1.11
and enables the tagging widget to correctly show existing tags
2017-07-03 15:21:52 +02:00
Alexey Ruzin
1931a98240 Chained select2 2017-04-18 10:57:33 +02:00
Johannes Hoppe
5840622794 Add support for Django 1.11
Drop support for Django 1.9
2017-04-14 14:09:23 +02:00
Tim Tisdall
9430a950c2 refer to the correct class 2016-12-05 14:54:11 +01:00
Tim Tisdall
15dbbf41a7 retain order of choices
If the choices are put into a `set` then the order is lost.  Regardless, I don't think a `set` is very useful here as this won't even deal with duplicate choice values/ids (ex. `(('1', 'one'), ('1', 'also one'))`)
2016-12-05 14:47:49 +01:00
Josef Kolář
72616f8276 ModelSelect2Mixin - avoid queryset evaluation (#287) 2016-08-14 10:38:57 +02:00
Jonas Haag
74bf15ce48 Drop six requirement, use django.utils.six instead (#282)
* Drop six requirement, use django.utils.six instead

* Drop six requirement, use django.utils.six instead

* Make isort happy
2016-06-19 12:27:49 +02:00
Johannes Hoppe
f943fe07f5 Fixes #256 -- Don't render empty option for multiselect (#275) 2016-05-23 16:17:31 +02:00
Julian
0b3abb8f1f Fixes minor documentation typo 2016-04-03 13:20:53 +02:00
Jônatas Castro
01c8979100 Fixes #238 -- Changed Token Separators
When Django was parsing the separator attribute, it was comming with 'u' char from unicode.
So the trick was to put the value in a String.
Solved https://github.com/applegrew/django-select2/issues/238

Closes #268
2016-03-10 15:34:30 +01:00
Damir Arbula
f6ee1f57db Add exception handling for cPickle.PicklingError to widget caching
Closes #265
2016-03-08 16:30:47 +01:00
Damir Arbula
9ed8f58fa6 Fixes #260 -- Normalize choices keys and selected choices to strings 2016-03-01 10:08:41 +01:00
Johannnes Hoppe
a8a4baf04d Fixes #261 -- Adds better hints if widget is not serialisable to django cache
Closes #263
2016-02-24 18:51:39 +01:00
Johannes Hoppe
7923eeb0ee Removes choices from render and render_options signature
Choices has been removed by @jpic in
926e90132d
2016-02-08 10:13:10 +01:00
Johannes Hoppe
4dacbdf283 enchant the docs -- adds spell checking 2016-02-04 11:48:59 +01:00
Johannes Hoppe
bc9601b3d3 Refactor inheritance tree 2016-02-04 11:48:42 +01:00
Johannes Hoppe
d57b726d34 Adds napoleon to march to google style signatures 2016-02-04 11:48:07 +01:00
Johannes Hoppe
d25e733c85 Fixes #245 -- Fixes ModelSelect2TagWidget documentation
There where multiple typos and missing references

Closed #248
2016-02-04 10:59:42 +01:00
Johannes Hoppe
0ee50d9866 Fixes pickel issue of lazy object 2016-01-27 10:01:19 +01:00
Johannes Hoppe
4a1b83ad1e Fixes security bug and adds secruity documentation
An attacker was able to use a `field_id` from a "secret" field
and use if on any even the default public select2 view and
receive the data without authentication.
2016-01-26 13:18:36 +01:00
mostafa-anm
33a00c1e39 Fixed #218 -- Add custom label support
Added `label_from_instance` method for model widgets to define custom option labels.

Closed #233
2016-01-19 08:50:09 +01:00
Andrew Dodd
e655ed7a59 Add setting to change source of select2 assets
These changes introduce additional (optional) configuration parameters.
The parameters allow the user of the library to select different JS/CSS
libraries from the ones shipped. In particular, this allows serving from
the local server and/or in private-network-only environments.

Refs #220
Closed #239
2015-12-15 19:57:48 +01:00
Johannes Hoppe
6ebeb4c6d7 Fixed pep257 issues 2015-12-02 19:40:14 +01:00
Johannes Hoppe
4defb8112b Fixed #222 -- Display intital data for heavy widgets 2015-12-01 10:19:02 +01:00
Johannes Hoppe
bb90be77b7 Fixed #231 -- Avoid fetching entire queryset from db
Patched ciritcal memory leak in ModelSelect2 widgets.
Boolean evaluation of queryset makes django fetch all
elements.

Thanks to @magicjohnson for discovering this issue
2015-11-30 13:17:02 +01:00
Johannes Hoppe
18647161a1 Fixed docs 2015-11-29 20:47:22 +01:00
Royendgel Silberie
3e6c1fc3ba fixing small typo
Closed #227
2015-11-29 20:03:01 +01:00
Johannes Hoppe
19a8d63bb1 Refactors tag widgets and adds light tag widget
Currently there was no light version of the tag widget.
A light version might come handy if you use a postgres
`ArrayField` and a corresponding `SimpleArrayField`.

Resolved #226
2015-11-23 11:54:51 +01:00
Thomas Schreiber
2beb5d23c7 Fix HeavySelect2TagWidget to respect custom attrs and default overrides
Closed #214
2015-10-27 17:44:22 +01:00
Johannes Hoppe
2c1eb8bc4a Fixed -- IndexError: pop from empty list 2015-10-05 12:59:35 +02:00
Johannes Hoppe
75c8c38e2d Impooved cacheing to reduce pickling issues
Not not the entire widget gets cached nor the entire queryset.
The query and gets pickeld separately.
2015-10-01 14:07:51 +02:00
Johannes Hoppe
dc81c2b3b5 Added search term splitting 2015-10-01 13:05:52 +02:00
Johannes Hoppe
485ea191cb Fixed filter_queryset bug
The reduce statement coundn't handle multiple lookup strings.
2015-09-30 10:28:37 +02:00
Johannes Hoppe
f301dc6f9d Added documentation 2015-09-29 14:33:06 +02:00
Johannes Hoppe
5dfd8553cc Added tests 2015-09-29 13:55:05 +02:00
Johannes Hoppe
f80abb10f2 Added allow-clear support 2015-09-29 13:55:05 +02:00
Johannes Hoppe
6dad55eb11 Upgrade to select2 4.0 2015-09-29 13:55:05 +02:00
Johannes Hoppe
95297a362e Radical removal of all unneeded code 2015-09-29 13:54:23 +02:00
Renamed from django_select2/widgets.py (Browse further)