From a4bc3273038e563a0a74adbb01ad36177bdef039 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Jul 2023 05:50:38 +0000 Subject: [PATCH 01/35] Bump black from 23.3.0 to 23.7.0 Bumps [black](https://github.com/psf/black) from 23.3.0 to 23.7.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/23.3.0...23.7.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 3523059f..8d64fa20 100644 --- a/linter-requirements.txt +++ b/linter-requirements.txt @@ -1,5 +1,5 @@ bandit==1.7.5 -black==23.3.0 +black==23.7.0 flake8==6.0.0 isort==5.12.0 pydocstyle[toml]==6.3.0 From 5753384b489c283b7b08f9f4346c80a5a735fbe6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 31 Jul 2023 05:29:45 +0000 Subject: [PATCH 02/35] Bump flake8 from 6.0.0 to 6.1.0 Bumps [flake8](https://github.com/pycqa/flake8) from 6.0.0 to 6.1.0. - [Commits](https://github.com/pycqa/flake8/compare/6.0.0...6.1.0) --- updated-dependencies: - dependency-name: flake8 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 8d64fa20..77d18507 100644 --- a/linter-requirements.txt +++ b/linter-requirements.txt @@ -1,5 +1,5 @@ bandit==1.7.5 black==23.7.0 -flake8==6.0.0 +flake8==6.1.0 isort==5.12.0 pydocstyle[toml]==6.3.0 From 681fac9ad7d64fe9991c60e9b33d4c85ad2637e6 Mon Sep 17 00:00:00 2001 From: Klaas van Schelven Date: Mon, 4 Sep 2023 19:17:47 +0200 Subject: [PATCH 03/35] Note case in which cache is not needed (#233) Co-authored-by: Johannes Maron --- django_select2/forms.py | 67 +++++++++++++++++++++++------------------ docs/conf.py | 1 + docs/index.rst | 5 +-- 3 files changed, 41 insertions(+), 32 deletions(-) diff --git a/django_select2/forms.py b/django_select2/forms.py index 1c0c7059..96846038 100644 --- a/django_select2/forms.py +++ b/django_select2/forms.py @@ -7,36 +7,43 @@ library, hence these components are meant to be used with choice fields. -Widgets are generally of two types: - - 1. **Light** -- - They are not meant to be used when there - are too many options, say, in thousands. - This is because all those options would - have to be pre-rendered onto the page - and JavaScript would be used to search - through them. Said that, they are also one - the easiest to use. They are a - drop-in-replacement for Django's default - select widgets. - - 2(a). **Heavy** -- - They are suited for scenarios when the number of options - are large and need complex queries (from maybe different - sources) to get the options. - - This dynamic fetching of options undoubtedly requires - Ajax communication with the server. Django-Select2 includes - a helper JS file which is included automatically, - so you need not worry about writing any Ajax related JS code. - Although on the server side you do need to create a view - specifically to respond to the queries. - - 2(b). **Model** -- - Model-widgets are a further specialized versions of Heavies. - These do not require views to serve Ajax requests. - When they are instantiated, they register themselves - with one central view which handles Ajax requests for them. +Widgets are generally of tree types: +Light, Heavy and Model. + +Light +~~~~~ + +They are not meant to be used when there +are too many options, say, in thousands. +This is because all those options would +have to be pre-rendered onto the page +and JavaScript would be used to search +through them. Said that, they are also one +the easiest to use. They are a +drop-in-replacement for Django's default +select widgets. + +Heavy +~~~~~ + +They are suited for scenarios when the number of options +are large and need complex queries (from maybe different +sources) to get the options. + +This dynamic fetching of options undoubtedly requires +Ajax communication with the server. Django-Select2 includes +a helper JS file which is included automatically, +so you need not worry about writing any Ajax related JS code. +Although on the server side you do need to create a view +specifically to respond to the queries. + +Model +~~~~~ + +Model-widgets are a further specialized versions of Heavies. +These do not require views to serve Ajax requests. +When they are instantiated, they register themselves +with one central view which handles Ajax requests for them. Heavy and Model widgets have respectively the word 'Heavy' and 'Model' in their name. Light widgets are normally named, i.e. there is no 'Light' word diff --git a/docs/conf.py b/docs/conf.py index b339972f..845ceecd 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -31,6 +31,7 @@ extensions = [ "sphinx.ext.autodoc", + "sphinx.ext.autosectionlabel", "sphinx.ext.napoleon", "sphinx.ext.inheritance_diagram", "sphinx.ext.intersphinx", diff --git a/docs/index.rst b/docs/index.rst index 35454f9c..0b2772ea 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -32,8 +32,9 @@ Add ``django_select`` to your URL root configuration: ] -``django-select2`` requires a cache backend which is **persistent** -across all application servers.. +The :ref:`Model` -widgets require a **persistent** cache backend across +all application servers. This is because the widget needs to store +meta data to be able to fetch the results based on the user input. **This means that the** :class:`.DummyCache` **backend will not work!** From cb1142b31b77f271f6ff88a2c9ff7e22e53ad145 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Sep 2023 05:17:18 +0000 Subject: [PATCH 04/35] Bump actions/checkout from 3 to 4 Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 12 ++++++------ .github/workflows/release.yml | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e2e16142..18c9710e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: - isort --check-only --diff . - pydocstyle . steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: python-version: "3.x" @@ -30,7 +30,7 @@ jobs: dist: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: python-version: "3.x" @@ -41,7 +41,7 @@ jobs: standardjs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-node@v3 with: node-version: '12.x' @@ -51,7 +51,7 @@ jobs: docs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: python-version: "3.10" @@ -76,7 +76,7 @@ jobs: - "4.2" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} @@ -95,7 +95,7 @@ jobs: - "3.x" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install Chrome run: sudo apt-get install -y google-chrome-stable - name: Install Selenium diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f6548af4..0d68a559 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,7 +8,7 @@ jobs: PyPI: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: python-version: "3.x" @@ -23,7 +23,7 @@ jobs: npm: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-node@v3 - uses: actions/setup-python@v4 with: From 9b7eea49aedd2a97db09fbb5abc8f6b5dc2ad1d1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Sep 2023 05:44:27 +0000 Subject: [PATCH 05/35] Bump black from 23.7.0 to 23.9.1 Bumps [black](https://github.com/psf/black) from 23.7.0 to 23.9.1. - [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/23.7.0...23.9.1) --- 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 77d18507..d132dc97 100644 --- a/linter-requirements.txt +++ b/linter-requirements.txt @@ -1,5 +1,5 @@ bandit==1.7.5 -black==23.7.0 +black==23.9.1 flake8==6.1.0 isort==5.12.0 pydocstyle[toml]==6.3.0 From d0704c462c6dff71883ab85f81376172527a1867 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 15 Sep 2023 05:32:08 +0000 Subject: [PATCH 06/35] Bump codecov/codecov-action from 3 to 4 Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 3 to 4. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v3...v4) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 18c9710e..b754d4de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,7 +83,7 @@ jobs: - run: python -m pip install Django~="${{ matrix.django-version }}.0" - run: python -m pip install -e .[test] - run: python -m pytest -m "not selenium" - - uses: codecov/codecov-action@v3 + - uses: codecov/codecov-action@v4 Selenium: needs: @@ -109,4 +109,4 @@ jobs: - run: python -m pip install Django - run: python -m pip install -e .[test,selenium] - run: python -m pytest -m selenium - - uses: codecov/codecov-action@v3 + - uses: codecov/codecov-action@v4 From 2cd60943c5076c2e78d64d5d70771a370b9e22b6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 Oct 2023 05:07:26 +0000 Subject: [PATCH 07/35] Bump black from 23.9.1 to 23.10.0 Bumps [black](https://github.com/psf/black) from 23.9.1 to 23.10.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/23.9.1...23.10.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 d132dc97..2f7cbf58 100644 --- a/linter-requirements.txt +++ b/linter-requirements.txt @@ -1,5 +1,5 @@ bandit==1.7.5 -black==23.9.1 +black==23.10.0 flake8==6.1.0 isort==5.12.0 pydocstyle[toml]==6.3.0 From 85fba6b8a40bc66a75bc57b2a509be24ae28c2d0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 24 Oct 2023 05:49:28 +0000 Subject: [PATCH 08/35] Bump black from 23.10.0 to 23.10.1 Bumps [black](https://github.com/psf/black) from 23.10.0 to 23.10.1. - [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/23.10.0...23.10.1) --- updated-dependencies: - dependency-name: black 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 2f7cbf58..3ff65113 100644 --- a/linter-requirements.txt +++ b/linter-requirements.txt @@ -1,5 +1,5 @@ bandit==1.7.5 -black==23.10.0 +black==23.10.1 flake8==6.1.0 isort==5.12.0 pydocstyle[toml]==6.3.0 From 2ec738949411ae845ebb16ae306d8e282ca2b4f5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 24 Oct 2023 05:47:45 +0000 Subject: [PATCH 09/35] Bump actions/setup-node from 3 to 4 Bumps [actions/setup-node](https://github.com/actions/setup-node) from 3 to 4. - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](https://github.com/actions/setup-node/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/setup-node dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b754d4de..4b238cee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: '12.x' - run: npm install -g standard diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0d68a559..3eb0a40b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,7 +24,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 - uses: actions/setup-python@v4 with: python-version: "3.x" From 69eef256d8c2a47ca6e13b370e8ed79fdac3093d Mon Sep 17 00:00:00 2001 From: Johannes Maron Date: Fri, 27 Oct 2023 16:56:45 +0200 Subject: [PATCH 10/35] Revert "Bump codecov/codecov-action from 3 to 4" This reverts commit d0704c462c6dff71883ab85f81376172527a1867. --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4b238cee..5d959da7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,7 +83,7 @@ jobs: - run: python -m pip install Django~="${{ matrix.django-version }}.0" - run: python -m pip install -e .[test] - run: python -m pytest -m "not selenium" - - uses: codecov/codecov-action@v4 + - uses: codecov/codecov-action@v3 Selenium: needs: @@ -109,4 +109,4 @@ jobs: - run: python -m pip install Django - run: python -m pip install -e .[test,selenium] - run: python -m pytest -m selenium - - uses: codecov/codecov-action@v4 + - uses: codecov/codecov-action@v3 From 05ec6c551f9d0915ddaf4604b8ae5824c769c53b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 9 Nov 2023 05:04:01 +0000 Subject: [PATCH 11/35] Bump black from 23.10.1 to 23.11.0 Bumps [black](https://github.com/psf/black) from 23.10.1 to 23.11.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/23.10.1...23.11.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 3ff65113..56e8bc79 100644 --- a/linter-requirements.txt +++ b/linter-requirements.txt @@ -1,5 +1,5 @@ bandit==1.7.5 -black==23.10.1 +black==23.11.0 flake8==6.1.0 isort==5.12.0 pydocstyle[toml]==6.3.0 From 29f2908b549fba96292a6af8d8dbb7fa136e1327 Mon Sep 17 00:00:00 2001 From: Johannes Maron Date: Fri, 24 Nov 2023 13:40:23 +0100 Subject: [PATCH 12/35] Update issue tempaltes --- .github/ISSUE_TEMPLATE/bug.yml | 52 +++++++++++++++++++ .github/ISSUE_TEMPLATE/bug_report.md | 30 ----------- .github/ISSUE_TEMPLATE/feature.yml | 11 ++++ .github/ISSUE_TEMPLATE/feature_request.md | 20 ------- .../problem-with-django-admin.md | 13 ----- .github/ISSUE_TEMPLATE/question.md | 17 ------ .github/ISSUE_TEMPLATE/question.yml | 11 ++++ 7 files changed, 74 insertions(+), 80 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug.yml delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature.yml delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md delete mode 100644 .github/ISSUE_TEMPLATE/problem-with-django-admin.md delete mode 100644 .github/ISSUE_TEMPLATE/question.md create mode 100644 .github/ISSUE_TEMPLATE/question.yml diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml new file mode 100644 index 00000000..66e8eda0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -0,0 +1,52 @@ +name: 🐛 Bug +description: Report a technical issue. +title: '🐛 ' +labels: + - bug +assignees: + - codingjoe +body: + + - type: markdown + attributes: + value: | + Thank you for taking the time to report a bug. + Please fill in as much of the template below as you're able. + + - type: markdown + attributes: + value: | + ## Security issues + Please do not report security issues here. + Instead, disclose them as described in our [security policy](https://github.com/codingjoe/django-select2/security). + + - type: textarea + id: bug-description + attributes: + label: Bug Description + description: A clear and concise description of what the bug is. + placeholder: I found a bug + validations: + required: true + + - type: textarea + id: bug-steps + attributes: + label: Steps to Reproduce + description: Steps to reproduce the behavior. + placeholder: | + 1. Go to '...' + 2. Click on '....' + 3. Scroll down to '....' + 4. See error + validations: + required: true + + - type: textarea + id: bug-expected + attributes: + label: Expected Behavior + description: A clear and concise description of what you expected to happen. + placeholder: I expected the app to do X + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 61090361..00000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: '' -labels: bug -assignees: codingjoe - ---- - -**Describe the bug** -A clear and concise description of what the bug is. - -**Exception & Traceback** -Should you have run into an exception, please provide us with the exception as well as with the full traceback. - -**Code Snippet** -Please provide us with a code example on how to reproduce the error. - -**To Reproduce** -Steps to reproduce the behavior: -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**Screenshots** -If applicable, add screenshots to help explain your problem. diff --git a/.github/ISSUE_TEMPLATE/feature.yml b/.github/ISSUE_TEMPLATE/feature.yml new file mode 100644 index 00000000..98acba30 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature.yml @@ -0,0 +1,11 @@ +name: ✨ Feature +description: Request an enhancement. +body: + + - type: markdown + attributes: + value: | + ## Discussions + + This project uses GitHub Discussions for feature requests. + Please use the [Ideas Section](https://github.com/codingjoe/django-select2/discussions/categories/ideas) to discuss your idea with the community. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index bbcbbe7d..00000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: '' -assignees: '' - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/problem-with-django-admin.md b/.github/ISSUE_TEMPLATE/problem-with-django-admin.md deleted file mode 100644 index ce54f92c..00000000 --- a/.github/ISSUE_TEMPLATE/problem-with-django-admin.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -name: Problem with Django admin -about: You are facing a problem integrating django-select2 into Django's admin interface -title: '' -labels: wontfix -assignees: '' - ---- - -Django-Select2 does NOT support Django admin, since Django admin has a built-in feature called `autocomplete_fields`. Autocomplete fields are superior and we recommend using them, instead of this package for the admin. - -You can find more information here: -https://docs.djangoproject.com/en/stable/ref/contrib/admin/#django.contrib.admin.ModelAdmin.autocomplete_fields diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md deleted file mode 100644 index ae936a5e..00000000 --- a/.github/ISSUE_TEMPLATE/question.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -name: Question -about: You have a question about Django-Select2 -title: '' -labels: question -assignees: '' - ---- - -**Goal** -Please describe your goal in all detail. What are you trying to do - -**Problem** -Please describe your problem in all detail. Where are you struggling? - -**Code Snippet** -Please provide a code snippet of your problem. diff --git a/.github/ISSUE_TEMPLATE/question.yml b/.github/ISSUE_TEMPLATE/question.yml new file mode 100644 index 00000000..413ed544 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.yml @@ -0,0 +1,11 @@ +name: 🙋 Question +description: Get help from the community. +body: + + - type: markdown + attributes: + value: | + ## Discussions + + This project uses GitHub Discussions to answer your questions. + Please use the [Q&A](https://github.com/codingjoe/django-select2/discussions/categories/q-a) to discuss your idea with the community. From 3532dce016ed2e75e71d2b0096cf4146e39e6f4a Mon Sep 17 00:00:00 2001 From: Johannes Maron Date: Fri, 24 Nov 2023 13:47:00 +0100 Subject: [PATCH 13/35] Add a issues config file --- .github/ISSUE_TEMPLATE/config.yml | 11 +++++++++++ .github/ISSUE_TEMPLATE/feature.yml | 11 ----------- .github/ISSUE_TEMPLATE/question.yml | 11 ----------- 3 files changed, 11 insertions(+), 22 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/config.yml delete mode 100644 .github/ISSUE_TEMPLATE/feature.yml delete mode 100644 .github/ISSUE_TEMPLATE/question.yml diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..2fc862f5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,11 @@ +blank_issues_enabled: false +contact_links: + - name: Security Policy + url: https://github.com/codingjoe/django-select2/security + about: Please do not disclose security vulnerabilities via GitHub issues. + - name: ✨ Feature Requests + url: https://github.com/codingjoe/django-select2/discussions/categories/ideas + about: Please use the GitHub Discussions to request new features. + - name: 🙋 Questions & Help + url: https://github.com/codingjoe/django-select2/discussions/categories/q-a + about: Please use the GitHub Discussions to ask questions. diff --git a/.github/ISSUE_TEMPLATE/feature.yml b/.github/ISSUE_TEMPLATE/feature.yml deleted file mode 100644 index 98acba30..00000000 --- a/.github/ISSUE_TEMPLATE/feature.yml +++ /dev/null @@ -1,11 +0,0 @@ -name: ✨ Feature -description: Request an enhancement. -body: - - - type: markdown - attributes: - value: | - ## Discussions - - This project uses GitHub Discussions for feature requests. - Please use the [Ideas Section](https://github.com/codingjoe/django-select2/discussions/categories/ideas) to discuss your idea with the community. diff --git a/.github/ISSUE_TEMPLATE/question.yml b/.github/ISSUE_TEMPLATE/question.yml deleted file mode 100644 index 413ed544..00000000 --- a/.github/ISSUE_TEMPLATE/question.yml +++ /dev/null @@ -1,11 +0,0 @@ -name: 🙋 Question -description: Get help from the community. -body: - - - type: markdown - attributes: - value: | - ## Discussions - - This project uses GitHub Discussions to answer your questions. - Please use the [Q&A](https://github.com/codingjoe/django-select2/discussions/categories/q-a) to discuss your idea with the community. From 69dd8921781e1771f54ad10733d5e1beff6e7043 Mon Sep 17 00:00:00 2001 From: Johannes Maron Date: Fri, 24 Nov 2023 13:48:35 +0100 Subject: [PATCH 14/35] Drop secuirty link in favor of CVE --- .github/ISSUE_TEMPLATE/config.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 2fc862f5..68d01326 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,8 +1,5 @@ blank_issues_enabled: false contact_links: - - name: Security Policy - url: https://github.com/codingjoe/django-select2/security - about: Please do not disclose security vulnerabilities via GitHub issues. - name: ✨ Feature Requests url: https://github.com/codingjoe/django-select2/discussions/categories/ideas about: Please use the GitHub Discussions to request new features. From c458e3e332eb247c1a9042019cccab2a9a5af00c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Dec 2023 05:07:47 +0000 Subject: [PATCH 15/35] Bump bandit from 1.7.5 to 1.7.6 Bumps [bandit](https://github.com/PyCQA/bandit) from 1.7.5 to 1.7.6. - [Release notes](https://github.com/PyCQA/bandit/releases) - [Commits](https://github.com/PyCQA/bandit/compare/1.7.5...1.7.6) --- updated-dependencies: - dependency-name: bandit 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 56e8bc79..dbcba5e9 100644 --- a/linter-requirements.txt +++ b/linter-requirements.txt @@ -1,4 +1,4 @@ -bandit==1.7.5 +bandit==1.7.6 black==23.11.0 flake8==6.1.0 isort==5.12.0 From 47ecddc639c28489d868e425187ef7bde389c927 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Dec 2023 08:54:06 +0000 Subject: [PATCH 16/35] Bump isort from 5.12.0 to 5.13.0 Bumps [isort](https://github.com/pycqa/isort) from 5.12.0 to 5.13.0. - [Release notes](https://github.com/pycqa/isort/releases) - [Changelog](https://github.com/PyCQA/isort/blob/main/CHANGELOG.md) - [Commits](https://github.com/pycqa/isort/compare/5.12.0...5.13.0) --- updated-dependencies: - dependency-name: isort 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 dbcba5e9..91a398c8 100644 --- a/linter-requirements.txt +++ b/linter-requirements.txt @@ -1,5 +1,5 @@ bandit==1.7.6 black==23.11.0 flake8==6.1.0 -isort==5.12.0 +isort==5.13.0 pydocstyle[toml]==6.3.0 From a88987de4fb19ccb4d57e751f3dddbf75256a2f1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 7 Dec 2023 05:02:28 +0000 Subject: [PATCH 17/35] Bump actions/setup-python from 4 to 5 Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 5. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 10 +++++----- .github/workflows/release.yml | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d959da7..766f40f5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: - pydocstyle . steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: "3.x" cache: 'pip' @@ -31,7 +31,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: "3.x" - run: python -m pip install --upgrade pip build wheel twine readme-renderer @@ -52,7 +52,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: "3.10" - run: sudo apt-get install -y gettext graphviz @@ -77,7 +77,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - run: python -m pip install Django~="${{ matrix.django-version }}.0" @@ -103,7 +103,7 @@ jobs: mkdir bin curl -O https://chromedriver.storage.googleapis.com/`curl -s https://chromedriver.storage.googleapis.com/LATEST_RELEASE`/chromedriver_linux64.zip unzip chromedriver_linux64.zip -d bin - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - run: python -m pip install Django diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3eb0a40b..29ff0b81 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: "3.x" - run: python -m pip install --upgrade pip build wheel twine @@ -25,7 +25,7 @@ jobs: steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: "3.x" - run: python -m pip install --upgrade setuptools_scm From 9e2a14e8c6d40add1f4db67be5790a4126499897 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Dec 2023 05:33:47 +0000 Subject: [PATCH 18/35] Bump isort from 5.13.0 to 5.13.1 Bumps [isort](https://github.com/pycqa/isort) from 5.13.0 to 5.13.1. - [Release notes](https://github.com/pycqa/isort/releases) - [Changelog](https://github.com/PyCQA/isort/blob/main/CHANGELOG.md) - [Commits](https://github.com/pycqa/isort/compare/5.13.0...5.13.1) --- updated-dependencies: - dependency-name: isort 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 91a398c8..2a8b219e 100644 --- a/linter-requirements.txt +++ b/linter-requirements.txt @@ -1,5 +1,5 @@ bandit==1.7.6 black==23.11.0 flake8==6.1.0 -isort==5.13.0 +isort==5.13.1 pydocstyle[toml]==6.3.0 From 94b9cc391018886cf02e3b3692565a5c24f698d9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Dec 2023 05:49:53 +0000 Subject: [PATCH 19/35] Bump black from 23.11.0 to 23.12.0 Bumps [black](https://github.com/psf/black) from 23.11.0 to 23.12.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/23.11.0...23.12.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 2a8b219e..67d627d2 100644 --- a/linter-requirements.txt +++ b/linter-requirements.txt @@ -1,5 +1,5 @@ bandit==1.7.6 -black==23.11.0 +black==23.12.0 flake8==6.1.0 isort==5.13.1 pydocstyle[toml]==6.3.0 From 38927504572f301c9f717e15b9f1900fffedeb95 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Dec 2023 06:00:13 +0000 Subject: [PATCH 20/35] Bump isort from 5.13.1 to 5.13.2 Bumps [isort](https://github.com/pycqa/isort) from 5.13.1 to 5.13.2. - [Release notes](https://github.com/pycqa/isort/releases) - [Changelog](https://github.com/PyCQA/isort/blob/main/CHANGELOG.md) - [Commits](https://github.com/pycqa/isort/compare/5.13.1...5.13.2) --- updated-dependencies: - dependency-name: isort 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 67d627d2..06e16b83 100644 --- a/linter-requirements.txt +++ b/linter-requirements.txt @@ -1,5 +1,5 @@ bandit==1.7.6 black==23.12.0 flake8==6.1.0 -isort==5.13.1 +isort==5.13.2 pydocstyle[toml]==6.3.0 From d1a3d51188081b3457c0abb00ba4e62c438210b2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Dec 2023 05:43:37 +0000 Subject: [PATCH 21/35] Bump black from 23.12.0 to 23.12.1 Bumps [black](https://github.com/psf/black) from 23.12.0 to 23.12.1. - [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/23.12.0...23.12.1) --- updated-dependencies: - dependency-name: black 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 06e16b83..68fe48ea 100644 --- a/linter-requirements.txt +++ b/linter-requirements.txt @@ -1,5 +1,5 @@ bandit==1.7.6 -black==23.12.0 +black==23.12.1 flake8==6.1.0 isort==5.13.2 pydocstyle[toml]==6.3.0 From dc12b38cea32a2bc5b4bd1f093ce7b23fa115c1a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 5 Jan 2024 05:03:59 +0000 Subject: [PATCH 22/35] Bump flake8 from 6.1.0 to 7.0.0 Bumps [flake8](https://github.com/pycqa/flake8) from 6.1.0 to 7.0.0. - [Commits](https://github.com/pycqa/flake8/compare/6.1.0...7.0.0) --- updated-dependencies: - dependency-name: flake8 dependency-type: direct:production update-type: version-update:semver-major ... 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 68fe48ea..c0482d19 100644 --- a/linter-requirements.txt +++ b/linter-requirements.txt @@ -1,5 +1,5 @@ bandit==1.7.6 black==23.12.1 -flake8==6.1.0 +flake8==7.0.0 isort==5.13.2 pydocstyle[toml]==6.3.0 From f61b09c6dabcb26d7311ddd69671900454328f97 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 24 Jan 2024 05:36:43 +0000 Subject: [PATCH 23/35] Bump bandit from 1.7.6 to 1.7.7 Bumps [bandit](https://github.com/PyCQA/bandit) from 1.7.6 to 1.7.7. - [Release notes](https://github.com/PyCQA/bandit/releases) - [Commits](https://github.com/PyCQA/bandit/compare/1.7.6...1.7.7) --- updated-dependencies: - dependency-name: bandit 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 c0482d19..c262708e 100644 --- a/linter-requirements.txt +++ b/linter-requirements.txt @@ -1,4 +1,4 @@ -bandit==1.7.6 +bandit==1.7.7 black==23.12.1 flake8==7.0.0 isort==5.13.2 From ec2464507547d0c6fa0f1632469e670facd0c13c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 26 Jan 2024 05:57:05 +0000 Subject: [PATCH 24/35] Bump black from 23.12.1 to 24.1.0 Bumps [black](https://github.com/psf/black) from 23.12.1 to 24.1.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/23.12.1...24.1.0) --- updated-dependencies: - dependency-name: black dependency-type: direct:production update-type: version-update:semver-major ... 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 c262708e..dd19df68 100644 --- a/linter-requirements.txt +++ b/linter-requirements.txt @@ -1,5 +1,5 @@ bandit==1.7.7 -black==23.12.1 +black==24.1.0 flake8==7.0.0 isort==5.13.2 pydocstyle[toml]==6.3.0 From 15e2d855d50de503b6c6941e2e5581260fa8f6f1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Feb 2024 05:59:33 +0000 Subject: [PATCH 25/35] Bump codecov/codecov-action from 3 to 4 Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 3 to 4. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v3...v4) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 766f40f5..0a3c1aa7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,7 +83,7 @@ jobs: - run: python -m pip install Django~="${{ matrix.django-version }}.0" - run: python -m pip install -e .[test] - run: python -m pytest -m "not selenium" - - uses: codecov/codecov-action@v3 + - uses: codecov/codecov-action@v4 Selenium: needs: @@ -109,4 +109,4 @@ jobs: - run: python -m pip install Django - run: python -m pip install -e .[test,selenium] - run: python -m pytest -m selenium - - uses: codecov/codecov-action@v3 + - uses: codecov/codecov-action@v4 From 21f30eaffd9b9500a0ee41c0a0d405f5182b6889 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 11 Feb 2024 13:41:00 +0100 Subject: [PATCH 26/35] Bump black from 24.1.0 to 24.1.1 (#264) --- django_select2/__init__.py | 1 + django_select2/apps.py | 1 + django_select2/cache.py | 1 + django_select2/conf.py | 1 + django_select2/forms.py | 1 + django_select2/urls.py | 1 + django_select2/views.py | 1 + linter-requirements.txt | 2 +- 8 files changed, 8 insertions(+), 1 deletion(-) diff --git a/django_select2/__init__.py b/django_select2/__init__.py index 95783ce7..4966ddc6 100644 --- a/django_select2/__init__.py +++ b/django_select2/__init__.py @@ -7,6 +7,7 @@ .. _Select2: https://select2.org/ """ + from django import get_version from . import _version diff --git a/django_select2/apps.py b/django_select2/apps.py index 77b053ac..cc7d0b26 100644 --- a/django_select2/apps.py +++ b/django_select2/apps.py @@ -1,4 +1,5 @@ """Django application configuration.""" + from django.apps import AppConfig diff --git a/django_select2/cache.py b/django_select2/cache.py index ce8953d0..6dbac226 100644 --- a/django_select2/cache.py +++ b/django_select2/cache.py @@ -11,6 +11,7 @@ .. _django.core.cache: https://docs.djangoproject.com/en/dev/topics/cache/ """ + from django.core.cache import caches from .conf import settings diff --git a/django_select2/conf.py b/django_select2/conf.py index a704eb17..e66b55d9 100644 --- a/django_select2/conf.py +++ b/django_select2/conf.py @@ -1,4 +1,5 @@ """Settings for Django-Select2.""" + from appconf import AppConf from django.conf import settings # NOQA diff --git a/django_select2/forms.py b/django_select2/forms.py index 96846038..bf9026a8 100644 --- a/django_select2/forms.py +++ b/django_select2/forms.py @@ -53,6 +53,7 @@ :parts: 1 """ + import operator import uuid from functools import reduce diff --git a/django_select2/urls.py b/django_select2/urls.py index 69c0f148..9f40776d 100644 --- a/django_select2/urls.py +++ b/django_select2/urls.py @@ -9,6 +9,7 @@ path('select2/', include('django_select2.urls')), """ + from django.urls import path from .views import AutoResponseView diff --git a/django_select2/views.py b/django_select2/views.py index 66fdc420..64bff43e 100644 --- a/django_select2/views.py +++ b/django_select2/views.py @@ -1,4 +1,5 @@ """JSONResponse views for model widgets.""" + from django.core import signing from django.core.signing import BadSignature from django.http import Http404, JsonResponse diff --git a/linter-requirements.txt b/linter-requirements.txt index dd19df68..b25090e7 100644 --- a/linter-requirements.txt +++ b/linter-requirements.txt @@ -1,5 +1,5 @@ bandit==1.7.7 -black==24.1.0 +black==24.1.1 flake8==7.0.0 isort==5.13.2 pydocstyle[toml]==6.3.0 From d044bd851fa00af977e38c6d27b8cd5f0a28c186 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Feb 2024 05:43:46 +0000 Subject: [PATCH 27/35] Bump black from 24.1.1 to 24.2.0 Bumps [black](https://github.com/psf/black) from 24.1.1 to 24.2.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.1.1...24.2.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 b25090e7..475dbf02 100644 --- a/linter-requirements.txt +++ b/linter-requirements.txt @@ -1,5 +1,5 @@ bandit==1.7.7 -black==24.1.1 +black==24.2.0 flake8==7.0.0 isort==5.13.2 pydocstyle[toml]==6.3.0 From 5e1ba196b664de4c616cb7cbd0e8c9ff44252054 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Mar 2024 05:12:06 +0000 Subject: [PATCH 28/35] Bump bandit from 1.7.7 to 1.7.8 Bumps [bandit](https://github.com/PyCQA/bandit) from 1.7.7 to 1.7.8. - [Release notes](https://github.com/PyCQA/bandit/releases) - [Commits](https://github.com/PyCQA/bandit/compare/1.7.7...1.7.8) --- updated-dependencies: - dependency-name: bandit 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 475dbf02..b5d36ad1 100644 --- a/linter-requirements.txt +++ b/linter-requirements.txt @@ -1,4 +1,4 @@ -bandit==1.7.7 +bandit==1.7.8 black==24.2.0 flake8==7.0.0 isort==5.13.2 From 73330182bdfd63d9fbe2acd68c6f9d8f1569bdfc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Mar 2024 05:36:07 +0000 Subject: [PATCH 29/35] Bump black from 24.2.0 to 24.3.0 Bumps [black](https://github.com/psf/black) from 24.2.0 to 24.3.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.2.0...24.3.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 b5d36ad1..a9c0ed04 100644 --- a/linter-requirements.txt +++ b/linter-requirements.txt @@ -1,5 +1,5 @@ bandit==1.7.8 -black==24.2.0 +black==24.3.0 flake8==7.0.0 isort==5.13.2 pydocstyle[toml]==6.3.0 From 5c70aff4a628a0c52179811ba08386ca2b82fe67 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Apr 2024 05:31:57 +0000 Subject: [PATCH 30/35] Bump black from 24.3.0 to 24.4.0 Bumps [black](https://github.com/psf/black) from 24.3.0 to 24.4.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.3.0...24.4.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 a9c0ed04..25dd0f07 100644 --- a/linter-requirements.txt +++ b/linter-requirements.txt @@ -1,5 +1,5 @@ bandit==1.7.8 -black==24.3.0 +black==24.4.0 flake8==7.0.0 isort==5.13.2 pydocstyle[toml]==6.3.0 From 97dd17531e66ab0855be9fdf833050ce90727d35 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 25 Apr 2024 05:16:09 +0000 Subject: [PATCH 31/35] Bump black from 24.4.0 to 24.4.1 Bumps [black](https://github.com/psf/black) from 24.4.0 to 24.4.1. - [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.0...24.4.1) --- updated-dependencies: - dependency-name: black 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 25dd0f07..11870526 100644 --- a/linter-requirements.txt +++ b/linter-requirements.txt @@ -1,5 +1,5 @@ bandit==1.7.8 -black==24.4.0 +black==24.4.1 flake8==7.0.0 isort==5.13.2 pydocstyle[toml]==6.3.0 From f427b3113d47cf60ab524e9c32cbd336e01417c5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 26 Apr 2024 05:22:30 +0000 Subject: [PATCH 32/35] Bump black from 24.4.1 to 24.4.2 Bumps [black](https://github.com/psf/black) from 24.4.1 to 24.4.2. - [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.1...24.4.2) --- updated-dependencies: - dependency-name: black 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 11870526..ce0fa00a 100644 --- a/linter-requirements.txt +++ b/linter-requirements.txt @@ -1,5 +1,5 @@ bandit==1.7.8 -black==24.4.1 +black==24.4.2 flake8==7.0.0 isort==5.13.2 pydocstyle[toml]==6.3.0 From 2a2cefded6501dff9c6606ac0562c5d4c2f1f7e8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Jun 2024 05:44:58 +0000 Subject: [PATCH 33/35] Bump flake8 from 7.0.0 to 7.1.0 Bumps [flake8](https://github.com/pycqa/flake8) from 7.0.0 to 7.1.0. - [Commits](https://github.com/pycqa/flake8/compare/7.0.0...7.1.0) --- updated-dependencies: - dependency-name: flake8 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 ce0fa00a..95557d3a 100644 --- a/linter-requirements.txt +++ b/linter-requirements.txt @@ -1,5 +1,5 @@ bandit==1.7.8 black==24.4.2 -flake8==7.0.0 +flake8==7.1.0 isort==5.13.2 pydocstyle[toml]==6.3.0 From 06a437dde8651fc2320330369c04a2ba0315dd0c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Jun 2024 09:18:45 +0000 Subject: [PATCH 34/35] Bump bandit from 1.7.8 to 1.7.9 Bumps [bandit](https://github.com/PyCQA/bandit) from 1.7.8 to 1.7.9. - [Release notes](https://github.com/PyCQA/bandit/releases) - [Commits](https://github.com/PyCQA/bandit/compare/1.7.8...1.7.9) --- updated-dependencies: - dependency-name: bandit 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 95557d3a..4b8d76cb 100644 --- a/linter-requirements.txt +++ b/linter-requirements.txt @@ -1,4 +1,4 @@ -bandit==1.7.8 +bandit==1.7.9 black==24.4.2 flake8==7.1.0 isort==5.13.2 From 07ea4b8cf996eb587fd3dacf4361bd579d83e8e2 Mon Sep 17 00:00:00 2001 From: Mark G Date: Sat, 29 Jun 2024 16:35:53 +0200 Subject: [PATCH 35/35] Add ModelSelect2Mixin.result_from_instance method (#272) Enable users to easily override the result JSON per widget without implementing a separate view. --------- Co-authored-by: Johannes Maron --- django_select2/forms.py | 22 ++++++++++++++++++++++ django_select2/views.py | 5 ++++- tests/test_forms.py | 9 +++++++++ tests/test_views.py | 23 ++++++++++++++++++++++- tests/testapp/forms.py | 14 ++++++++++++++ 5 files changed, 71 insertions(+), 2 deletions(-) diff --git a/django_select2/forms.py b/django_select2/forms.py index bf9026a8..02860075 100644 --- a/django_select2/forms.py +++ b/django_select2/forms.py @@ -554,6 +554,28 @@ def label_from_instance(obj): """ return str(obj) + def result_from_instance(self, obj, request): + """ + Return a dictionary representing the object. + + Can be overridden to change the result returned by + :class:`.AutoResponseView` for each object. + + The request passed in will correspond to the request sent to the + :class:`.AutoResponseView` by the widget. + + Example usage:: + + class MyWidget(ModelSelect2Widget): + def result_from_instance(obj, request): + return { + 'id': obj.pk, + 'text': self.label_from_instance(obj), + 'extra_data': obj.extra_data, + } + """ + return {"id": obj.pk, "text": self.label_from_instance(obj)} + class ModelSelect2Widget(ModelSelect2Mixin, HeavySelect2Widget): """ diff --git a/django_select2/views.py b/django_select2/views.py index 64bff43e..f78f19ea 100644 --- a/django_select2/views.py +++ b/django_select2/views.py @@ -21,6 +21,9 @@ def get(self, request, *args, **kwargs): """ Return a :class:`.django.http.JsonResponse`. + Each result will be rendered by the widget's + :func:`django_select2.forms.ModelSelect2Mixin.result_from_instance` method. + Example:: { @@ -41,7 +44,7 @@ def get(self, request, *args, **kwargs): return JsonResponse( { "results": [ - {"text": self.widget.label_from_instance(obj), "id": obj.pk} + self.widget.result_from_instance(obj, request) for obj in context["object_list"] ], "more": context["page_obj"].has_next(), diff --git a/tests/test_forms.py b/tests/test_forms.py index c7281949..ddb0f328 100644 --- a/tests/test_forms.py +++ b/tests/test_forms.py @@ -438,6 +438,15 @@ def test_get_queryset(self): widget.queryset = Genre.objects.all() assert isinstance(widget.get_queryset(), QuerySet) + def test_result_from_instance_ModelSelect2Widget(self, genres): + widget = ModelSelect2Widget() + widget.model = Genre + genre = Genre.objects.first() + assert widget.result_from_instance(genre, request=None) == { + "id": genre.pk, + "text": str(genre), + } + def test_tag_attrs_Select2Widget(self): widget = Select2Widget() output = widget.render("name", "value") diff --git a/tests/test_views.py b/tests/test_views.py index e63ffe80..745dbfad 100644 --- a/tests/test_views.py +++ b/tests/test_views.py @@ -4,7 +4,11 @@ from django_select2.cache import cache from django_select2.forms import ModelSelect2Widget -from tests.testapp.forms import AlbumModelSelect2WidgetForm, ArtistCustomTitleWidget +from tests.testapp.forms import ( + AlbumModelSelect2WidgetForm, + ArtistCustomTitleWidget, + CityForm, +) from tests.testapp.models import Genre try: @@ -84,6 +88,23 @@ def test_label_from_instance(self, artists, client): "results" ] + def test_result_from_instance(self, cities, client): + url = reverse("django_select2:auto-json") + + form = CityForm() + assert form.as_p() + field_id = form.fields["city"].widget.field_id + city = cities[0] + response = client.get(url, {"field_id": field_id, "term": city.name}) + assert response.status_code == 200 + data = json.loads(response.content.decode("utf-8")) + assert data["results"] + assert { + "id": city.pk, + "text": smart_str(city), + "country": smart_str(city.country), + } in data["results"] + def test_url_check(self, client, artists): artist = artists[0] form = AlbumModelSelect2WidgetForm() diff --git a/tests/testapp/forms.py b/tests/testapp/forms.py index ed90f222..0b115339 100644 --- a/tests/testapp/forms.py +++ b/tests/testapp/forms.py @@ -232,3 +232,17 @@ class Meta: model = models.Groupie fields = "__all__" widgets = {"obsession": ArtistCustomTitleWidget} + + +class CityModelSelect2Widget(ModelSelect2Widget): + model = City + search_fields = ["name"] + + def result_from_instance(self, obj, request): + return {"id": obj.pk, "text": obj.name, "country": str(obj.country)} + + +class CityForm(forms.Form): + city = forms.ModelChoiceField( + queryset=City.objects.all(), widget=CityModelSelect2Widget(), required=False + )