django-dynamic-admin-forms 3.0.3__tar.gz → 3.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/.ambient-package-update/metadata.py +9 -3
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/.ambient-package-update/templates/snippets/content.tpl +20 -24
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/.ambient-package-update/templates/snippets/installation.tpl +4 -7
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/.github/workflows/ci.yml +10 -9
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/.pre-commit-config.yaml +12 -4
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/CHANGES.md +27 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/PKG-INFO +31 -37
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/README.md +24 -31
- django_dynamic_admin_forms-3.2.2/SECURITY.md +18 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/django_dynamic_admin_forms/__init__.py +1 -1
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/docs/conf.py +0 -2
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/pyproject.toml +26 -17
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/tests/test_admin_unit.py +0 -2
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/.coveragerc +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/.editorconfig +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/.gitignore +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/.python-version +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/.readthedocs.yaml +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/LICENSE.md +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/MANIFEST.in +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/django_dynamic_admin_forms/admin.py +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/django_dynamic_admin_forms/apps.py +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/django_dynamic_admin_forms/static/js/dynamic_admin.js +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/django_dynamic_admin_forms/templates/admin/change_form.html +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/django_dynamic_admin_forms/urls.py +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/docs/Makefile +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/docs/demo.gif +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/docs/features/changelog.rst +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/docs/index.rst +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/docs/make.bat +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/e2e/cypress/integration/dynamic-select.spec.js +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/e2e/cypress/plugins/index.js +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/e2e/cypress/support/commands.js +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/e2e/cypress/support/index.js +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/e2e/cypress/support/paths.js +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/e2e/cypress.json +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/e2e/package.json +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/e2e/yarn.lock +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/fixtures/fixtures-dev.json +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/manage.py +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/scripts/unix/install_requirements.sh +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/scripts/unix/publish_to_pypi.sh +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/scripts/windows/install_requirements.ps1 +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/scripts/windows/publish_to_pypi.ps1 +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/settings.py +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/setup.cfg +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/testapp/__init__.py +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/testapp/admin.py +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/testapp/apps.py +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/testapp/migrations/0001_initial.py +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/testapp/migrations/0002_extend_example.py +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/testapp/migrations/0003_example_file_field.py +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/testapp/migrations/__init__.py +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/testapp/models.py +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/testapp/urls.py +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/tests/__init__.py +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/tests/test_admin_generic.py +0 -0
|
@@ -7,10 +7,11 @@ from ambient_package_update.metadata.constants import (
|
|
|
7
7
|
from ambient_package_update.metadata.maintainer import PackageMaintainer
|
|
8
8
|
from ambient_package_update.metadata.package import PackageMetadata
|
|
9
9
|
from ambient_package_update.metadata.readme import ReadmeContent
|
|
10
|
+
from ambient_package_update.metadata.ruff_ignored_inspection import RuffIgnoredInspection
|
|
10
11
|
|
|
11
12
|
METADATA = PackageMetadata(
|
|
12
13
|
package_name="django_dynamic_admin_forms",
|
|
13
|
-
|
|
14
|
+
github_package_group="ambient-innovation",
|
|
14
15
|
github_package_name="django_dynamic_admin",
|
|
15
16
|
company="Ambient Innovation: GmbH",
|
|
16
17
|
authors=[
|
|
@@ -33,7 +34,7 @@ METADATA = PackageMetadata(
|
|
|
33
34
|
supported_django_versions=SUPPORTED_DJANGO_VERSIONS,
|
|
34
35
|
supported_python_versions=SUPPORTED_PYTHON_VERSIONS,
|
|
35
36
|
dependencies=[
|
|
36
|
-
"
|
|
37
|
+
f"Django>={SUPPORTED_DJANGO_VERSIONS[0]}",
|
|
37
38
|
],
|
|
38
39
|
optional_dependencies={
|
|
39
40
|
"dev": [
|
|
@@ -41,5 +42,10 @@ METADATA = PackageMetadata(
|
|
|
41
42
|
"unittest-parametrize~=1.4",
|
|
42
43
|
],
|
|
43
44
|
},
|
|
44
|
-
ruff_ignore_list=[
|
|
45
|
+
ruff_ignore_list=[
|
|
46
|
+
RuffIgnoredInspection(
|
|
47
|
+
key="RUF012", comment="Mutable class attributes should be annotated with `typing.ClassVar`"
|
|
48
|
+
),
|
|
49
|
+
RuffIgnoredInspection(key="TRY003", comment="Avoid specifying long messages outside the exception class"),
|
|
50
|
+
],
|
|
45
51
|
)
|
|
@@ -16,10 +16,8 @@ Add simple interactions to the otherwise static django admin.
|
|
|
16
16
|
- Add the module to `INSTALLED_APPS`:
|
|
17
17
|
```python
|
|
18
18
|
INSTALLED_APPS = (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
'django.contrib.admin'
|
|
22
|
-
...
|
|
19
|
+
"django_dynamic_admin_forms",
|
|
20
|
+
"django.contrib.admin",
|
|
23
21
|
)
|
|
24
22
|
```
|
|
25
23
|
Ensure that the `dynamic_admin_forms` comes before the
|
|
@@ -30,9 +28,8 @@ Add simple interactions to the otherwise static django admin.
|
|
|
30
28
|
```python
|
|
31
29
|
TEMPLATES = [
|
|
32
30
|
{
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
...
|
|
31
|
+
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
|
32
|
+
"APP_DIRS": True,
|
|
36
33
|
},
|
|
37
34
|
]
|
|
38
35
|
```
|
|
@@ -46,8 +43,8 @@ Add simple interactions to the otherwise static django admin.
|
|
|
46
43
|
from django.urls import path, include
|
|
47
44
|
|
|
48
45
|
urlpatterns = [
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
path("admin/", admin.site.urls),
|
|
47
|
+
path("dynamic-admin-form/", include("django_dynamic_admin_forms.urls")),
|
|
51
48
|
]
|
|
52
49
|
```
|
|
53
50
|
- In addition to the standard `fields` declaration, specify a list of `dynamic_fields`
|
|
@@ -68,23 +65,22 @@ Add simple interactions to the otherwise static django admin.
|
|
|
68
65
|
|
|
69
66
|
@admin.register(MyModel)
|
|
70
67
|
class MyModelAdmin(DynamicModelAdminMixin, admin.ModelAdmin):
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
68
|
+
fields = ("name", "city")
|
|
69
|
+
dynamic_fields = ("city",)
|
|
70
|
+
|
|
71
|
+
def get_dynamic_city_field(self, data):
|
|
72
|
+
# automatically choose first city that matches first letter of name
|
|
73
|
+
name = data.get("name")
|
|
74
|
+
if not name:
|
|
75
|
+
queryset = City.objects.all()
|
|
76
|
+
value = data.get("city")
|
|
77
|
+
else:
|
|
78
|
+
queryset = City.objects.filter(name__startswith=name[0])
|
|
79
|
+
value = queryset.first()
|
|
80
|
+
hidden = not queryset.exists()
|
|
81
|
+
return queryset, value, hidden
|
|
85
82
|
```
|
|
86
83
|
|
|
87
|
-
|
|
88
84
|
## How it works
|
|
89
85
|
Whenever a dynamic form changes, an event handler makes a request to a special endpoint, which returns new HTML to swap
|
|
90
86
|
into the existing form. This new HTML is directly generated by `django.contrib.admin`, so we only have to set the
|
|
@@ -11,10 +11,8 @@
|
|
|
11
11
|
- Add the module to `INSTALLED_APPS`:
|
|
12
12
|
```python
|
|
13
13
|
INSTALLED_APPS = (
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
'django.contrib.admin'
|
|
17
|
-
...
|
|
14
|
+
"django_dynamic_admin_forms",
|
|
15
|
+
"django.contrib.admin",
|
|
18
16
|
)
|
|
19
17
|
```
|
|
20
18
|
Ensure that the `dynamic_admin_forms` comes before the
|
|
@@ -26,9 +24,8 @@
|
|
|
26
24
|
```python
|
|
27
25
|
TEMPLATES = [
|
|
28
26
|
{
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
...
|
|
27
|
+
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
|
28
|
+
"APP_DIRS": True,
|
|
32
29
|
},
|
|
33
30
|
]
|
|
34
31
|
```
|
{django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/.github/workflows/ci.yml
RENAMED
|
@@ -27,14 +27,14 @@ jobs:
|
|
|
27
27
|
runs-on: ubuntu-22.04
|
|
28
28
|
strategy:
|
|
29
29
|
matrix:
|
|
30
|
-
python-version: ['3.
|
|
31
|
-
django-version: ['42', '50', ]
|
|
30
|
+
python-version: ['3.9', '3.10', '3.11', '3.12', ]
|
|
31
|
+
django-version: ['42', '50', '51', ]
|
|
32
32
|
|
|
33
33
|
exclude:
|
|
34
|
-
- python-version: '3.8'
|
|
35
|
-
django-version: 50
|
|
36
34
|
- python-version: '3.9'
|
|
37
35
|
django-version: 50
|
|
36
|
+
- python-version: '3.9'
|
|
37
|
+
django-version: 51
|
|
38
38
|
|
|
39
39
|
steps:
|
|
40
40
|
- uses: actions/checkout@v4
|
|
@@ -49,9 +49,9 @@ jobs:
|
|
|
49
49
|
TOXENV: django${{ matrix.django-version }}
|
|
50
50
|
run: tox
|
|
51
51
|
- name: Upload coverage data
|
|
52
|
-
uses: actions/upload-artifact@
|
|
52
|
+
uses: actions/upload-artifact@v4
|
|
53
53
|
with:
|
|
54
|
-
name: coverage-data
|
|
54
|
+
name: coverage-data-${{ matrix.python-version }}-${{ matrix.django-version }}
|
|
55
55
|
path: '.coverage*'
|
|
56
56
|
|
|
57
57
|
coverage:
|
|
@@ -69,11 +69,12 @@ jobs:
|
|
|
69
69
|
run: python -m pip install --upgrade coverage[toml]
|
|
70
70
|
|
|
71
71
|
- name: Download data
|
|
72
|
-
uses: actions/download-artifact@
|
|
72
|
+
uses: actions/download-artifact@v4
|
|
73
73
|
with:
|
|
74
|
-
|
|
74
|
+
pattern: coverage-data*
|
|
75
|
+
merge-multiple: true
|
|
75
76
|
|
|
76
|
-
- name: Combine coverage and fail if it's <100%
|
|
77
|
+
- name: Combine coverage and fail if it's <100.0%
|
|
77
78
|
run: |
|
|
78
79
|
python -m coverage html --skip-covered --skip-empty
|
|
79
80
|
python -m coverage report --fail-under=100.0
|
{django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/.pre-commit-config.yaml
RENAMED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
repos:
|
|
5
5
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
6
|
-
rev: v0.4
|
|
6
|
+
rev: v0.6.4
|
|
7
7
|
hooks:
|
|
8
8
|
# Run the Ruff linter.
|
|
9
9
|
- id: ruff
|
|
@@ -11,15 +11,23 @@ repos:
|
|
|
11
11
|
# Run the Ruff formatter.
|
|
12
12
|
- id: ruff-format
|
|
13
13
|
|
|
14
|
+
- repo: https://github.com/adamchainz/blacken-docs
|
|
15
|
+
rev: 1.18.0
|
|
16
|
+
hooks:
|
|
17
|
+
- id: blacken-docs
|
|
18
|
+
additional_dependencies:
|
|
19
|
+
- black==24.4.2
|
|
20
|
+
files: '(?:README\.md|docs\/.*\.(?:md|rst))'
|
|
21
|
+
|
|
14
22
|
- repo: https://github.com/asottile/pyupgrade
|
|
15
|
-
rev: v3.
|
|
23
|
+
rev: v3.17.0
|
|
16
24
|
hooks:
|
|
17
25
|
- id: pyupgrade
|
|
18
|
-
args: [ --
|
|
26
|
+
args: [ --py39-plus ]
|
|
19
27
|
stages: [ push ]
|
|
20
28
|
|
|
21
29
|
- repo: https://github.com/adamchainz/django-upgrade
|
|
22
|
-
rev: 1.
|
|
30
|
+
rev: 1.21.0
|
|
23
31
|
hooks:
|
|
24
32
|
- id: django-upgrade
|
|
25
33
|
args: [--target-version, "4.2"]
|
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
* *3.2.2* (2024-09-11)
|
|
4
|
+
* Fixed package name
|
|
5
|
+
|
|
6
|
+
**3.2.1**
|
|
7
|
+
* Fixed test matrix
|
|
8
|
+
|
|
9
|
+
**3.2.0**
|
|
10
|
+
* Added Django 5.1 support
|
|
11
|
+
|
|
12
|
+
**3.1.3**
|
|
13
|
+
* Added SECURITY.md
|
|
14
|
+
* Updated linters
|
|
15
|
+
* Internal updates via `ambient-package-update`
|
|
16
|
+
|
|
17
|
+
**3.1.2**
|
|
18
|
+
* Updated GitHub actions
|
|
19
|
+
|
|
20
|
+
**3.1.1**
|
|
21
|
+
* Black-end documentation code
|
|
22
|
+
|
|
23
|
+
**3.1.0**
|
|
24
|
+
* Dropped support for Python 3.8
|
|
25
|
+
* Added multiple ruff linters
|
|
26
|
+
|
|
27
|
+
**3.0.4**
|
|
28
|
+
* Linted docs with `blacken-docs` via `ambient-package-update`
|
|
29
|
+
|
|
3
30
|
**3.0.3**
|
|
4
31
|
* Restructured Readme content
|
|
5
32
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: django-dynamic-admin-forms
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.2.2
|
|
4
4
|
Summary: Add simple dynamic interaction to the otherwise static django admin.
|
|
5
5
|
Author-email: Ambient Digital <hello@ambient.digital>, Fabian Binz <fabian.binz@ambient.digital>
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -9,32 +9,33 @@ Classifier: Environment :: Web Environment
|
|
|
9
9
|
Classifier: Framework :: Django
|
|
10
10
|
Classifier: Framework :: Django :: 4.2
|
|
11
11
|
Classifier: Framework :: Django :: 5.0
|
|
12
|
+
Classifier: Framework :: Django :: 5.1
|
|
12
13
|
Classifier: Intended Audience :: Developers
|
|
13
14
|
Classifier: License :: OSI Approved :: MIT License
|
|
14
15
|
Classifier: Natural Language :: English
|
|
15
16
|
Classifier: Operating System :: OS Independent
|
|
16
17
|
Classifier: Programming Language :: Python
|
|
17
18
|
Classifier: Programming Language :: Python :: 3
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
19
19
|
Classifier: Programming Language :: Python :: 3.9
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.10
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.11
|
|
22
22
|
Classifier: Programming Language :: Python :: 3.12
|
|
23
23
|
Classifier: Topic :: Utilities
|
|
24
|
-
Requires-Dist:
|
|
24
|
+
Requires-Dist: Django>=4.2
|
|
25
25
|
Requires-Dist: typer~=0.9 ; extra == "dev"
|
|
26
26
|
Requires-Dist: freezegun~=1.3 ; extra == "dev"
|
|
27
27
|
Requires-Dist: pytest-django~=4.7 ; extra == "dev"
|
|
28
28
|
Requires-Dist: pytest-mock~=3.12 ; extra == "dev"
|
|
29
29
|
Requires-Dist: coverage~=7.3 ; extra == "dev"
|
|
30
|
-
Requires-Dist: pre-commit~=3.
|
|
31
|
-
Requires-Dist: ruff~=0.
|
|
30
|
+
Requires-Dist: pre-commit~=3.7 ; extra == "dev"
|
|
31
|
+
Requires-Dist: ruff~=0.4 ; extra == "dev"
|
|
32
32
|
Requires-Dist: sphinx~=7.1 ; extra == "dev"
|
|
33
33
|
Requires-Dist: sphinx-rtd-theme~=2.0 ; extra == "dev"
|
|
34
34
|
Requires-Dist: m2r2==0.3.3.post2 ; extra == "dev"
|
|
35
35
|
Requires-Dist: mistune<2.0.0 ; extra == "dev"
|
|
36
36
|
Requires-Dist: flit~=3.9 ; extra == "dev"
|
|
37
|
-
Requires-Dist:
|
|
37
|
+
Requires-Dist: keyring~=25.2 ; extra == "dev"
|
|
38
|
+
Requires-Dist: ambient-package-update ; extra == "dev"
|
|
38
39
|
Requires-Dist: unittest-parametrize~=1.4 ; extra == "dev"
|
|
39
40
|
Project-URL: Bugtracker, https://github.com/ambient-innovation/django-dynamic-admin/issues
|
|
40
41
|
Project-URL: Changelog, https://django-dynamic-admin-forms.readthedocs.io/en/latest/features/changelog.html
|
|
@@ -76,10 +77,8 @@ Add simple interactions to the otherwise static django admin.
|
|
|
76
77
|
- Add the module to `INSTALLED_APPS`:
|
|
77
78
|
```python
|
|
78
79
|
INSTALLED_APPS = (
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
'django.contrib.admin'
|
|
82
|
-
...
|
|
80
|
+
"django_dynamic_admin_forms",
|
|
81
|
+
"django.contrib.admin",
|
|
83
82
|
)
|
|
84
83
|
```
|
|
85
84
|
Ensure that the `dynamic_admin_forms` comes before the
|
|
@@ -90,9 +89,8 @@ Add simple interactions to the otherwise static django admin.
|
|
|
90
89
|
```python
|
|
91
90
|
TEMPLATES = [
|
|
92
91
|
{
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
...
|
|
92
|
+
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
|
93
|
+
"APP_DIRS": True,
|
|
96
94
|
},
|
|
97
95
|
]
|
|
98
96
|
```
|
|
@@ -106,8 +104,8 @@ Add simple interactions to the otherwise static django admin.
|
|
|
106
104
|
from django.urls import path, include
|
|
107
105
|
|
|
108
106
|
urlpatterns = [
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
path("admin/", admin.site.urls),
|
|
108
|
+
path("dynamic-admin-form/", include("django_dynamic_admin_forms.urls")),
|
|
111
109
|
]
|
|
112
110
|
```
|
|
113
111
|
- In addition to the standard `fields` declaration, specify a list of `dynamic_fields`
|
|
@@ -128,23 +126,22 @@ Add simple interactions to the otherwise static django admin.
|
|
|
128
126
|
|
|
129
127
|
@admin.register(MyModel)
|
|
130
128
|
class MyModelAdmin(DynamicModelAdminMixin, admin.ModelAdmin):
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
129
|
+
fields = ("name", "city")
|
|
130
|
+
dynamic_fields = ("city",)
|
|
131
|
+
|
|
132
|
+
def get_dynamic_city_field(self, data):
|
|
133
|
+
# automatically choose first city that matches first letter of name
|
|
134
|
+
name = data.get("name")
|
|
135
|
+
if not name:
|
|
136
|
+
queryset = City.objects.all()
|
|
137
|
+
value = data.get("city")
|
|
138
|
+
else:
|
|
139
|
+
queryset = City.objects.filter(name__startswith=name[0])
|
|
140
|
+
value = queryset.first()
|
|
141
|
+
hidden = not queryset.exists()
|
|
142
|
+
return queryset, value, hidden
|
|
145
143
|
```
|
|
146
144
|
|
|
147
|
-
|
|
148
145
|
## How it works
|
|
149
146
|
Whenever a dynamic form changes, an event handler makes a request to a special endpoint, which returns new HTML to swap
|
|
150
147
|
into the existing form. This new HTML is directly generated by `django.contrib.admin`, so we only have to set the
|
|
@@ -200,10 +197,8 @@ $ yarn cypress # or npm run cypress
|
|
|
200
197
|
- Add the module to `INSTALLED_APPS`:
|
|
201
198
|
```python
|
|
202
199
|
INSTALLED_APPS = (
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
'django.contrib.admin'
|
|
206
|
-
...
|
|
200
|
+
"django_dynamic_admin_forms",
|
|
201
|
+
"django.contrib.admin",
|
|
207
202
|
)
|
|
208
203
|
```
|
|
209
204
|
Ensure that the `dynamic_admin_forms` comes before the
|
|
@@ -215,9 +210,8 @@ $ yarn cypress # or npm run cypress
|
|
|
215
210
|
```python
|
|
216
211
|
TEMPLATES = [
|
|
217
212
|
{
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
...
|
|
213
|
+
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
|
214
|
+
"APP_DIRS": True,
|
|
221
215
|
},
|
|
222
216
|
]
|
|
223
217
|
```
|
|
@@ -31,10 +31,8 @@ Add simple interactions to the otherwise static django admin.
|
|
|
31
31
|
- Add the module to `INSTALLED_APPS`:
|
|
32
32
|
```python
|
|
33
33
|
INSTALLED_APPS = (
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
'django.contrib.admin'
|
|
37
|
-
...
|
|
34
|
+
"django_dynamic_admin_forms",
|
|
35
|
+
"django.contrib.admin",
|
|
38
36
|
)
|
|
39
37
|
```
|
|
40
38
|
Ensure that the `dynamic_admin_forms` comes before the
|
|
@@ -45,9 +43,8 @@ Add simple interactions to the otherwise static django admin.
|
|
|
45
43
|
```python
|
|
46
44
|
TEMPLATES = [
|
|
47
45
|
{
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
...
|
|
46
|
+
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
|
47
|
+
"APP_DIRS": True,
|
|
51
48
|
},
|
|
52
49
|
]
|
|
53
50
|
```
|
|
@@ -61,8 +58,8 @@ Add simple interactions to the otherwise static django admin.
|
|
|
61
58
|
from django.urls import path, include
|
|
62
59
|
|
|
63
60
|
urlpatterns = [
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
path("admin/", admin.site.urls),
|
|
62
|
+
path("dynamic-admin-form/", include("django_dynamic_admin_forms.urls")),
|
|
66
63
|
]
|
|
67
64
|
```
|
|
68
65
|
- In addition to the standard `fields` declaration, specify a list of `dynamic_fields`
|
|
@@ -83,23 +80,22 @@ Add simple interactions to the otherwise static django admin.
|
|
|
83
80
|
|
|
84
81
|
@admin.register(MyModel)
|
|
85
82
|
class MyModelAdmin(DynamicModelAdminMixin, admin.ModelAdmin):
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
83
|
+
fields = ("name", "city")
|
|
84
|
+
dynamic_fields = ("city",)
|
|
85
|
+
|
|
86
|
+
def get_dynamic_city_field(self, data):
|
|
87
|
+
# automatically choose first city that matches first letter of name
|
|
88
|
+
name = data.get("name")
|
|
89
|
+
if not name:
|
|
90
|
+
queryset = City.objects.all()
|
|
91
|
+
value = data.get("city")
|
|
92
|
+
else:
|
|
93
|
+
queryset = City.objects.filter(name__startswith=name[0])
|
|
94
|
+
value = queryset.first()
|
|
95
|
+
hidden = not queryset.exists()
|
|
96
|
+
return queryset, value, hidden
|
|
100
97
|
```
|
|
101
98
|
|
|
102
|
-
|
|
103
99
|
## How it works
|
|
104
100
|
Whenever a dynamic form changes, an event handler makes a request to a special endpoint, which returns new HTML to swap
|
|
105
101
|
into the existing form. This new HTML is directly generated by `django.contrib.admin`, so we only have to set the
|
|
@@ -155,10 +151,8 @@ $ yarn cypress # or npm run cypress
|
|
|
155
151
|
- Add the module to `INSTALLED_APPS`:
|
|
156
152
|
```python
|
|
157
153
|
INSTALLED_APPS = (
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
'django.contrib.admin'
|
|
161
|
-
...
|
|
154
|
+
"django_dynamic_admin_forms",
|
|
155
|
+
"django.contrib.admin",
|
|
162
156
|
)
|
|
163
157
|
```
|
|
164
158
|
Ensure that the `dynamic_admin_forms` comes before the
|
|
@@ -170,9 +164,8 @@ $ yarn cypress # or npm run cypress
|
|
|
170
164
|
```python
|
|
171
165
|
TEMPLATES = [
|
|
172
166
|
{
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
...
|
|
167
|
+
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
|
168
|
+
"APP_DIRS": True,
|
|
176
169
|
},
|
|
177
170
|
]
|
|
178
171
|
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Reporting Security Issues
|
|
2
|
+
|
|
3
|
+
The maintainers of this package take security bugs seriously. We appreciate your efforts to responsibly
|
|
4
|
+
disclose your findings, and will make every effort to acknowledge your contributions.
|
|
5
|
+
|
|
6
|
+
To report a security issue, please use the GitHub Security
|
|
7
|
+
Advisory ["Report a Vulnerability"](https://github.com/ambient-innovation/django-dynamic-admin/security/advisories/new)
|
|
8
|
+
tab.
|
|
9
|
+
|
|
10
|
+
The maintainers will send a response indicating the next steps in handling your report. After the initial reply to
|
|
11
|
+
your report, the security team will keep you informed of the progress towards a fix and full announcement, and may ask
|
|
12
|
+
for additional information or guidance.
|
|
13
|
+
|
|
14
|
+
Report security bugs in third-party modules to the person or team maintaining the module.
|
|
15
|
+
|
|
16
|
+
## Source
|
|
17
|
+
|
|
18
|
+
This file was inspired by: https://github.com/electron/electron/blob/main/SECURITY.md
|
|
@@ -67,8 +67,6 @@ exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
|
|
|
67
67
|
|
|
68
68
|
# The theme to use for HTML and HTML Help pages. See the documentation for
|
|
69
69
|
# a list of builtin themes.
|
|
70
|
-
#
|
|
71
|
-
# html_theme = "alabaster"
|
|
72
70
|
html_theme = "sphinx_rtd_theme"
|
|
73
71
|
html_theme_options = {
|
|
74
72
|
"display_version": False,
|
|
@@ -15,13 +15,13 @@ classifiers = [
|
|
|
15
15
|
"Framework :: Django",
|
|
16
16
|
"Framework :: Django :: 4.2",
|
|
17
17
|
"Framework :: Django :: 5.0",
|
|
18
|
+
"Framework :: Django :: 5.1",
|
|
18
19
|
"Intended Audience :: Developers",
|
|
19
20
|
"License :: OSI Approved :: MIT License",
|
|
20
21
|
"Natural Language :: English",
|
|
21
22
|
"Operating System :: OS Independent",
|
|
22
23
|
"Programming Language :: Python",
|
|
23
24
|
"Programming Language :: Python :: 3",
|
|
24
|
-
"Programming Language :: Python :: 3.8",
|
|
25
25
|
"Programming Language :: Python :: 3.9",
|
|
26
26
|
"Programming Language :: Python :: 3.10",
|
|
27
27
|
"Programming Language :: Python :: 3.11",
|
|
@@ -31,7 +31,7 @@ classifiers = [
|
|
|
31
31
|
dynamic = ["version", "description"]
|
|
32
32
|
license = {"file" = "LICENSE.md"}
|
|
33
33
|
dependencies = [
|
|
34
|
-
'
|
|
34
|
+
'Django>=4.2',
|
|
35
35
|
]
|
|
36
36
|
|
|
37
37
|
|
|
@@ -42,14 +42,15 @@ dev = [
|
|
|
42
42
|
'pytest-django~=4.7',
|
|
43
43
|
'pytest-mock~=3.12',
|
|
44
44
|
'coverage~=7.3',
|
|
45
|
-
'pre-commit~=3.
|
|
46
|
-
'ruff~=0.
|
|
45
|
+
'pre-commit~=3.7',
|
|
46
|
+
'ruff~=0.4',
|
|
47
47
|
'sphinx~=7.1',
|
|
48
48
|
'sphinx-rtd-theme~=2.0',
|
|
49
49
|
'm2r2==0.3.3.post2',
|
|
50
50
|
'mistune<2.0.0',
|
|
51
51
|
'flit~=3.9',
|
|
52
|
-
'
|
|
52
|
+
'keyring~=25.2',
|
|
53
|
+
'ambient-package-update',
|
|
53
54
|
'unittest-parametrize~=1.4',
|
|
54
55
|
]
|
|
55
56
|
|
|
@@ -75,18 +76,25 @@ lint.select = [
|
|
|
75
76
|
"DTZ", # flake8-datetimez
|
|
76
77
|
"DJ", # flake8-django
|
|
77
78
|
"TD", # flake8-to-do
|
|
78
|
-
"
|
|
79
|
+
"RUF", # Ruff-specific rules
|
|
79
80
|
"YTT", # Avoid non-future-prove usages of "sys"
|
|
80
|
-
# "FBT", # Protects you from the "boolean trap bug"
|
|
81
81
|
"C4", # Checks for unnecessary conversions
|
|
82
82
|
"PIE", # Bunch of useful rules
|
|
83
|
-
# "SIM", # Simplifies your code
|
|
84
83
|
"INT", # Validates your gettext translation strings
|
|
85
84
|
"PERF", # PerfLint
|
|
86
85
|
"PGH", # No all-purpose "# noqa" and eval validation
|
|
87
86
|
"PL", # PyLint
|
|
87
|
+
"LOG", # flake8-logging
|
|
88
|
+
"TID", # flake8-tidy-imports
|
|
89
|
+
"PLR2004", # Magic numbers
|
|
90
|
+
"BLE", # Checks for except clauses that catch all exceptions
|
|
91
|
+
"ANN401", # Checks that function arguments are annotated with a more specific type than Any
|
|
92
|
+
"TRY", # Clean try/except
|
|
93
|
+
"ERA", # Commented out code
|
|
88
94
|
]
|
|
89
95
|
lint.ignore = [
|
|
96
|
+
'RUF012', # Mutable class attributes should be annotated with `typing.ClassVar`
|
|
97
|
+
'TRY003', # Avoid specifying long messages outside the exception class
|
|
90
98
|
]
|
|
91
99
|
|
|
92
100
|
# Allow autofix for all enabled rules (when `--fix`) is provided.
|
|
@@ -101,16 +109,21 @@ lint.fixable = [
|
|
|
101
109
|
"DTZ", # flake8-datetimez
|
|
102
110
|
"DJ", # flake8-django
|
|
103
111
|
"TD", # flake8-to-do
|
|
104
|
-
"
|
|
112
|
+
"RUF", # Ruff-specific rules
|
|
105
113
|
"YTT", # Avoid non-future-prove usages of "sys"
|
|
106
|
-
# "FBT", # Protects you from the "boolean trap bug"
|
|
107
114
|
"C4", # Checks for unnecessary conversions
|
|
108
115
|
"PIE", # Bunch of useful rules
|
|
109
|
-
# "SIM", # Simplifies your code
|
|
110
116
|
"INT", # Validates your gettext translation strings
|
|
111
117
|
"PERF", # PerfLint
|
|
112
118
|
"PGH", # No all-purpose "# noqa" and eval validation
|
|
113
119
|
"PL", # PyLint
|
|
120
|
+
"LOG", # flake8-logging
|
|
121
|
+
"TID", # flake8-tidy-imports
|
|
122
|
+
"PLR2004", # Magic numbers
|
|
123
|
+
"BLE", # Checks for except clauses that catch all exceptions
|
|
124
|
+
"ANN401", # Checks that function arguments are annotated with a more specific type than Any
|
|
125
|
+
"TRY", # Clean try/except
|
|
126
|
+
"ERA", # Commented out code
|
|
114
127
|
]
|
|
115
128
|
lint.unfixable = []
|
|
116
129
|
|
|
@@ -142,7 +155,7 @@ exclude = [
|
|
|
142
155
|
line-length = 120
|
|
143
156
|
|
|
144
157
|
# Allow unused variables when underscore-prefixed.
|
|
145
|
-
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
|
|
158
|
+
lint.dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
|
|
146
159
|
|
|
147
160
|
# Assume Python 3.12
|
|
148
161
|
target-version = "py312"
|
|
@@ -162,22 +175,18 @@ line-ending = "auto"
|
|
|
162
175
|
|
|
163
176
|
[tool.tox]
|
|
164
177
|
legacy_tox_ini = """
|
|
165
|
-
[tox]
|
|
166
|
-
envlist = py{38,39,310,311}-django{32,41,42}
|
|
167
|
-
isolated_build = True
|
|
168
|
-
|
|
169
178
|
[testenv]
|
|
170
179
|
# Django deprecation overview: https://www.djangoproject.com/download/
|
|
171
180
|
deps =
|
|
172
181
|
django42: Django==4.2.*
|
|
173
182
|
django50: Django==5.0.*
|
|
183
|
+
django51: Django==5.1.*
|
|
174
184
|
extras = dev,
|
|
175
185
|
commands =
|
|
176
186
|
coverage run -m pytest --ds settings tests
|
|
177
187
|
|
|
178
188
|
[gh-actions]
|
|
179
189
|
python =
|
|
180
|
-
3.8: py38
|
|
181
190
|
3.9: py39
|
|
182
191
|
3.10: py310
|
|
183
192
|
3.11: py311
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/docs/features/changelog.rst
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/e2e/cypress/plugins/index.js
RENAMED
|
File without changes
|
|
File without changes
|
{django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/e2e/cypress/support/index.js
RENAMED
|
File without changes
|
{django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/e2e/cypress/support/paths.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/fixtures/fixtures-dev.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/testapp/migrations/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.2.2}/tests/test_admin_generic.py
RENAMED
|
File without changes
|