From abcd0f7f5aad6abc98157a57dee07d231b11586e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marduk=20Bola=C3=B1os?= Date: Sun, 4 Aug 2024 11:37:42 +0200 Subject: [PATCH 1/4] Improve the documentation of Select2TagWidget (#291) As already [discussed](https://github.com/codingjoe/django-select2/discussions/290), the documentation of this widget is lacking. This PR adds a description of the functionality provided by the widget. --- django_select2/forms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django_select2/forms.py b/django_select2/forms.py index 02860075..69b1ee3c 100644 --- a/django_select2/forms.py +++ b/django_select2/forms.py @@ -221,7 +221,7 @@ class Select2MultipleWidget(Select2Mixin, forms.SelectMultiple): class Select2TagWidget(Select2TagMixin, Select2Mixin, forms.SelectMultiple): """ - Select2 drop in widget for for tagging. + Select2 drop in widget with tagging support. It allows to dynamically create new options from text input by the user. Example for :class:`.django.contrib.postgres.fields.ArrayField`:: From 6f5561d3565a0d0de8f8aa54daa6c88d2790591e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Aug 2024 05:32:28 +0000 Subject: [PATCH 2/4] Bump flake8 from 7.1.0 to 7.1.1 Bumps [flake8](https://github.com/pycqa/flake8) from 7.1.0 to 7.1.1. - [Commits](https://github.com/pycqa/flake8/compare/7.1.0...7.1.1) --- updated-dependencies: - dependency-name: flake8 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- linter-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linter-requirements.txt b/linter-requirements.txt index 4b8d76cb..1cc75de1 100644 --- a/linter-requirements.txt +++ b/linter-requirements.txt @@ -1,5 +1,5 @@ bandit==1.7.9 black==24.4.2 -flake8==7.1.0 +flake8==7.1.1 isort==5.13.2 pydocstyle[toml]==6.3.0 From d87a5ad51f92495f37eda321fc6cf43a72ff6218 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Aug 2024 12:16:59 +0000 Subject: [PATCH 3/4] Bump black from 24.4.2 to 24.8.0 Bumps [black](https://github.com/psf/black) from 24.4.2 to 24.8.0. - [Release notes](https://github.com/psf/black/releases) - [Changelog](https://github.com/psf/black/blob/main/CHANGES.md) - [Commits](https://github.com/psf/black/compare/24.4.2...24.8.0) --- updated-dependencies: - dependency-name: black dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- linter-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linter-requirements.txt b/linter-requirements.txt index 1cc75de1..459cdbb8 100644 --- a/linter-requirements.txt +++ b/linter-requirements.txt @@ -1,5 +1,5 @@ bandit==1.7.9 -black==24.4.2 +black==24.8.0 flake8==7.1.1 isort==5.13.2 pydocstyle[toml]==6.3.0 From 50c488c0125f571f87e30e480e21446338a1b3cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marduk=20Bola=C3=B1os?= Date: Fri, 9 Aug 2024 18:02:58 +0200 Subject: [PATCH 4/4] Fix #292 -- Change admin widgets' JS media ordering (#295) Select2Mixin now loads admin/js/jquery.init.js, just like the AutocompleteMixin of Django Admin. --------- Co-authored-by: Johannes Maron --- django_select2/forms.py | 6 +++++- tests/test_forms.py | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/django_select2/forms.py b/django_select2/forms.py index 69b1ee3c..85f84672 100644 --- a/django_select2/forms.py +++ b/django_select2/forms.py @@ -169,8 +169,12 @@ class Select2AdminMixin: def media(self): css = {**AutocompleteMixin(None, None).media._css} css["screen"].append("django_select2/django_select2.css") + js = [*Select2Mixin().media._js] + js.insert( + js.index("django_select2/django_select2.js"), "admin/js/jquery.init.js" + ) return forms.Media( - js=Select2Mixin().media._js, + js=js, css=css, ) diff --git a/tests/test_forms.py b/tests/test_forms.py index ddb0f328..71b0b042 100644 --- a/tests/test_forms.py +++ b/tests/test_forms.py @@ -188,6 +188,7 @@ def test_media(self): assert tuple(Select2AdminMixin().media._js) == ( "admin/js/vendor/select2/select2.full.min.js", "admin/js/vendor/select2/i18n/en.js", + "admin/js/jquery.init.js", "django_select2/django_select2.js", )