django-dynamic-admin-forms 3.0.3__tar.gz → 3.1.0__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.1.0}/.ambient-package-update/metadata.py +8 -2
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/.ambient-package-update/templates/snippets/content.tpl +4 -7
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/.ambient-package-update/templates/snippets/installation.tpl +1 -4
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/.github/workflows/ci.yml +2 -4
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/.pre-commit-config.yaml +9 -1
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/CHANGES.md +7 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/PKG-INFO +31 -37
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/README.md +24 -30
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/django_dynamic_admin_forms/__init__.py +1 -1
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/docs/conf.py +0 -2
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/pyproject.toml +25 -18
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/tests/test_admin_unit.py +0 -2
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/.coveragerc +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/.editorconfig +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/.gitignore +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/.python-version +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/.readthedocs.yaml +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/LICENSE.md +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/MANIFEST.in +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/django_dynamic_admin_forms/admin.py +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/django_dynamic_admin_forms/apps.py +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/django_dynamic_admin_forms/static/js/dynamic_admin.js +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/django_dynamic_admin_forms/templates/admin/change_form.html +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/django_dynamic_admin_forms/urls.py +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/docs/Makefile +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/docs/demo.gif +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/docs/features/changelog.rst +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/docs/index.rst +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/docs/make.bat +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/e2e/cypress/integration/dynamic-select.spec.js +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/e2e/cypress/plugins/index.js +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/e2e/cypress/support/commands.js +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/e2e/cypress/support/index.js +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/e2e/cypress/support/paths.js +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/e2e/cypress.json +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/e2e/package.json +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/e2e/yarn.lock +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/fixtures/fixtures-dev.json +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/manage.py +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/scripts/unix/install_requirements.sh +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/scripts/unix/publish_to_pypi.sh +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/scripts/windows/install_requirements.ps1 +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/scripts/windows/publish_to_pypi.ps1 +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/settings.py +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/setup.cfg +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/testapp/__init__.py +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/testapp/admin.py +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/testapp/apps.py +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/testapp/migrations/0001_initial.py +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/testapp/migrations/0002_extend_example.py +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/testapp/migrations/0003_example_file_field.py +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/testapp/migrations/__init__.py +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/testapp/models.py +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/testapp/urls.py +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/tests/__init__.py +0 -0
- {django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/tests/test_admin_generic.py +0 -0
|
@@ -7,6 +7,7 @@ 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",
|
|
@@ -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
|
```
|
|
@@ -11,10 +11,8 @@
|
|
|
11
11
|
- Add the module to `INSTALLED_APPS`:
|
|
12
12
|
```python
|
|
13
13
|
INSTALLED_APPS = (
|
|
14
|
-
...,
|
|
15
14
|
'django_dynamic_admin_forms',
|
|
16
|
-
'django.contrib.admin'
|
|
17
|
-
...
|
|
15
|
+
'django.contrib.admin',
|
|
18
16
|
)
|
|
19
17
|
```
|
|
20
18
|
Ensure that the `dynamic_admin_forms` comes before the
|
|
@@ -28,7 +26,6 @@
|
|
|
28
26
|
{
|
|
29
27
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
30
28
|
'APP_DIRS': True,
|
|
31
|
-
...
|
|
32
29
|
},
|
|
33
30
|
]
|
|
34
31
|
```
|
{django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/.github/workflows/ci.yml
RENAMED
|
@@ -27,12 +27,10 @@ jobs:
|
|
|
27
27
|
runs-on: ubuntu-22.04
|
|
28
28
|
strategy:
|
|
29
29
|
matrix:
|
|
30
|
-
python-version: ['3.
|
|
30
|
+
python-version: ['3.9', '3.10', '3.11', '3.12', ]
|
|
31
31
|
django-version: ['42', '50', ]
|
|
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
|
|
38
36
|
|
|
@@ -73,7 +71,7 @@ jobs:
|
|
|
73
71
|
with:
|
|
74
72
|
name: coverage-data
|
|
75
73
|
|
|
76
|
-
- name: Combine coverage and fail if it's <100%
|
|
74
|
+
- name: Combine coverage and fail if it's <100.0%
|
|
77
75
|
run: |
|
|
78
76
|
python -m coverage html --skip-covered --skip-empty
|
|
79
77
|
python -m coverage report --fail-under=100.0
|
{django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/.pre-commit-config.yaml
RENAMED
|
@@ -11,11 +11,19 @@ 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.16.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
23
|
rev: v3.16.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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
|
-
Name:
|
|
3
|
-
Version: 3.0
|
|
2
|
+
Name: django_dynamic_admin_forms
|
|
3
|
+
Version: 3.1.0
|
|
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
|
|
@@ -15,26 +15,26 @@ Classifier: Natural Language :: English
|
|
|
15
15
|
Classifier: Operating System :: OS Independent
|
|
16
16
|
Classifier: Programming Language :: Python
|
|
17
17
|
Classifier: Programming Language :: Python :: 3
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.9
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.10
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.11
|
|
22
21
|
Classifier: Programming Language :: Python :: 3.12
|
|
23
22
|
Classifier: Topic :: Utilities
|
|
24
|
-
Requires-Dist:
|
|
23
|
+
Requires-Dist: Django>=4.2
|
|
25
24
|
Requires-Dist: typer~=0.9 ; extra == "dev"
|
|
26
25
|
Requires-Dist: freezegun~=1.3 ; extra == "dev"
|
|
27
26
|
Requires-Dist: pytest-django~=4.7 ; extra == "dev"
|
|
28
27
|
Requires-Dist: pytest-mock~=3.12 ; extra == "dev"
|
|
29
28
|
Requires-Dist: coverage~=7.3 ; extra == "dev"
|
|
30
|
-
Requires-Dist: pre-commit~=3.
|
|
31
|
-
Requires-Dist: ruff~=0.
|
|
29
|
+
Requires-Dist: pre-commit~=3.7 ; extra == "dev"
|
|
30
|
+
Requires-Dist: ruff~=0.4 ; extra == "dev"
|
|
32
31
|
Requires-Dist: sphinx~=7.1 ; extra == "dev"
|
|
33
32
|
Requires-Dist: sphinx-rtd-theme~=2.0 ; extra == "dev"
|
|
34
33
|
Requires-Dist: m2r2==0.3.3.post2 ; extra == "dev"
|
|
35
34
|
Requires-Dist: mistune<2.0.0 ; extra == "dev"
|
|
36
35
|
Requires-Dist: flit~=3.9 ; extra == "dev"
|
|
37
|
-
Requires-Dist:
|
|
36
|
+
Requires-Dist: keyring~=25.2 ; extra == "dev"
|
|
37
|
+
Requires-Dist: ambient-package-update~=24.7.3 ; extra == "dev"
|
|
38
38
|
Requires-Dist: unittest-parametrize~=1.4 ; extra == "dev"
|
|
39
39
|
Project-URL: Bugtracker, https://github.com/ambient-innovation/django-dynamic-admin/issues
|
|
40
40
|
Project-URL: Changelog, https://django-dynamic-admin-forms.readthedocs.io/en/latest/features/changelog.html
|
|
@@ -76,10 +76,8 @@ Add simple interactions to the otherwise static django admin.
|
|
|
76
76
|
- Add the module to `INSTALLED_APPS`:
|
|
77
77
|
```python
|
|
78
78
|
INSTALLED_APPS = (
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
'django.contrib.admin'
|
|
82
|
-
...
|
|
79
|
+
"django_dynamic_admin_forms",
|
|
80
|
+
"django.contrib.admin",
|
|
83
81
|
)
|
|
84
82
|
```
|
|
85
83
|
Ensure that the `dynamic_admin_forms` comes before the
|
|
@@ -90,9 +88,8 @@ Add simple interactions to the otherwise static django admin.
|
|
|
90
88
|
```python
|
|
91
89
|
TEMPLATES = [
|
|
92
90
|
{
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
...
|
|
91
|
+
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
|
92
|
+
"APP_DIRS": True,
|
|
96
93
|
},
|
|
97
94
|
]
|
|
98
95
|
```
|
|
@@ -106,8 +103,8 @@ Add simple interactions to the otherwise static django admin.
|
|
|
106
103
|
from django.urls import path, include
|
|
107
104
|
|
|
108
105
|
urlpatterns = [
|
|
109
|
-
|
|
110
|
-
|
|
106
|
+
path("admin/", admin.site.urls),
|
|
107
|
+
path("dynamic-admin-form/", include("django_dynamic_admin_forms.urls")),
|
|
111
108
|
]
|
|
112
109
|
```
|
|
113
110
|
- In addition to the standard `fields` declaration, specify a list of `dynamic_fields`
|
|
@@ -128,20 +125,20 @@ Add simple interactions to the otherwise static django admin.
|
|
|
128
125
|
|
|
129
126
|
@admin.register(MyModel)
|
|
130
127
|
class MyModelAdmin(DynamicModelAdminMixin, admin.ModelAdmin):
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
128
|
+
fields = ("name", "city")
|
|
129
|
+
dynamic_fields = ("city",)
|
|
130
|
+
|
|
131
|
+
def get_dynamic_city_field(self, data):
|
|
132
|
+
# automatically choose first city that matches first letter of name
|
|
133
|
+
name = data.get("name")
|
|
134
|
+
if not name:
|
|
135
|
+
queryset = City.objects.all()
|
|
136
|
+
value = data.get("city")
|
|
137
|
+
else:
|
|
138
|
+
queryset = City.objects.filter(name__startswith=name[0])
|
|
139
|
+
value = queryset.first()
|
|
140
|
+
hidden = not queryset.exists()
|
|
141
|
+
return queryset, value, hidden
|
|
145
142
|
```
|
|
146
143
|
|
|
147
144
|
|
|
@@ -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,20 +80,20 @@ 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
99
|
|
|
@@ -155,10 +152,8 @@ $ yarn cypress # or npm run cypress
|
|
|
155
152
|
- Add the module to `INSTALLED_APPS`:
|
|
156
153
|
```python
|
|
157
154
|
INSTALLED_APPS = (
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
'django.contrib.admin'
|
|
161
|
-
...
|
|
155
|
+
"django_dynamic_admin_forms",
|
|
156
|
+
"django.contrib.admin",
|
|
162
157
|
)
|
|
163
158
|
```
|
|
164
159
|
Ensure that the `dynamic_admin_forms` comes before the
|
|
@@ -170,9 +165,8 @@ $ yarn cypress # or npm run cypress
|
|
|
170
165
|
```python
|
|
171
166
|
TEMPLATES = [
|
|
172
167
|
{
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
...
|
|
168
|
+
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
|
169
|
+
"APP_DIRS": True,
|
|
176
170
|
},
|
|
177
171
|
]
|
|
178
172
|
```
|
|
@@ -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,
|
|
@@ -3,7 +3,7 @@ requires = ["flit_core>=3.4"]
|
|
|
3
3
|
build-backend = "flit_core.buildapi"
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
|
-
name = "
|
|
6
|
+
name = "django_dynamic_admin_forms"
|
|
7
7
|
authors = [
|
|
8
8
|
{'name' = 'Ambient Digital', 'email' = 'hello@ambient.digital'},
|
|
9
9
|
{'name' = 'Fabian Binz', 'email' = 'fabian.binz@ambient.digital'},
|
|
@@ -21,7 +21,6 @@ classifiers = [
|
|
|
21
21
|
"Operating System :: OS Independent",
|
|
22
22
|
"Programming Language :: Python",
|
|
23
23
|
"Programming Language :: Python :: 3",
|
|
24
|
-
"Programming Language :: Python :: 3.8",
|
|
25
24
|
"Programming Language :: Python :: 3.9",
|
|
26
25
|
"Programming Language :: Python :: 3.10",
|
|
27
26
|
"Programming Language :: Python :: 3.11",
|
|
@@ -31,7 +30,7 @@ classifiers = [
|
|
|
31
30
|
dynamic = ["version", "description"]
|
|
32
31
|
license = {"file" = "LICENSE.md"}
|
|
33
32
|
dependencies = [
|
|
34
|
-
'
|
|
33
|
+
'Django>=4.2',
|
|
35
34
|
]
|
|
36
35
|
|
|
37
36
|
|
|
@@ -42,14 +41,15 @@ dev = [
|
|
|
42
41
|
'pytest-django~=4.7',
|
|
43
42
|
'pytest-mock~=3.12',
|
|
44
43
|
'coverage~=7.3',
|
|
45
|
-
'pre-commit~=3.
|
|
46
|
-
'ruff~=0.
|
|
44
|
+
'pre-commit~=3.7',
|
|
45
|
+
'ruff~=0.4',
|
|
47
46
|
'sphinx~=7.1',
|
|
48
47
|
'sphinx-rtd-theme~=2.0',
|
|
49
48
|
'm2r2==0.3.3.post2',
|
|
50
49
|
'mistune<2.0.0',
|
|
51
50
|
'flit~=3.9',
|
|
52
|
-
'
|
|
51
|
+
'keyring~=25.2',
|
|
52
|
+
'ambient-package-update~=24.7.3',
|
|
53
53
|
'unittest-parametrize~=1.4',
|
|
54
54
|
]
|
|
55
55
|
|
|
@@ -75,18 +75,25 @@ lint.select = [
|
|
|
75
75
|
"DTZ", # flake8-datetimez
|
|
76
76
|
"DJ", # flake8-django
|
|
77
77
|
"TD", # flake8-to-do
|
|
78
|
-
"
|
|
78
|
+
"RUF", # Ruff-specific rules
|
|
79
79
|
"YTT", # Avoid non-future-prove usages of "sys"
|
|
80
|
-
# "FBT", # Protects you from the "boolean trap bug"
|
|
81
80
|
"C4", # Checks for unnecessary conversions
|
|
82
81
|
"PIE", # Bunch of useful rules
|
|
83
|
-
# "SIM", # Simplifies your code
|
|
84
82
|
"INT", # Validates your gettext translation strings
|
|
85
83
|
"PERF", # PerfLint
|
|
86
84
|
"PGH", # No all-purpose "# noqa" and eval validation
|
|
87
85
|
"PL", # PyLint
|
|
86
|
+
"LOG", # flake8-logging
|
|
87
|
+
"TID", # flake8-tidy-imports
|
|
88
|
+
"PLR2004", # Magic numbers
|
|
89
|
+
"BLE", # Checks for except clauses that catch all exceptions
|
|
90
|
+
"ANN401", # Checks that function arguments are annotated with a more specific type than Any
|
|
91
|
+
"TRY", # Clean try/except
|
|
92
|
+
"ERA", # Commented out code
|
|
88
93
|
]
|
|
89
94
|
lint.ignore = [
|
|
95
|
+
'RUF012', # Mutable class attributes should be annotated with `typing.ClassVar`
|
|
96
|
+
'TRY003', # Avoid specifying long messages outside the exception class
|
|
90
97
|
]
|
|
91
98
|
|
|
92
99
|
# Allow autofix for all enabled rules (when `--fix`) is provided.
|
|
@@ -101,16 +108,21 @@ lint.fixable = [
|
|
|
101
108
|
"DTZ", # flake8-datetimez
|
|
102
109
|
"DJ", # flake8-django
|
|
103
110
|
"TD", # flake8-to-do
|
|
104
|
-
"
|
|
111
|
+
"RUF", # Ruff-specific rules
|
|
105
112
|
"YTT", # Avoid non-future-prove usages of "sys"
|
|
106
|
-
# "FBT", # Protects you from the "boolean trap bug"
|
|
107
113
|
"C4", # Checks for unnecessary conversions
|
|
108
114
|
"PIE", # Bunch of useful rules
|
|
109
|
-
# "SIM", # Simplifies your code
|
|
110
115
|
"INT", # Validates your gettext translation strings
|
|
111
116
|
"PERF", # PerfLint
|
|
112
117
|
"PGH", # No all-purpose "# noqa" and eval validation
|
|
113
118
|
"PL", # PyLint
|
|
119
|
+
"LOG", # flake8-logging
|
|
120
|
+
"TID", # flake8-tidy-imports
|
|
121
|
+
"PLR2004", # Magic numbers
|
|
122
|
+
"BLE", # Checks for except clauses that catch all exceptions
|
|
123
|
+
"ANN401", # Checks that function arguments are annotated with a more specific type than Any
|
|
124
|
+
"TRY", # Clean try/except
|
|
125
|
+
"ERA", # Commented out code
|
|
114
126
|
]
|
|
115
127
|
lint.unfixable = []
|
|
116
128
|
|
|
@@ -142,7 +154,7 @@ exclude = [
|
|
|
142
154
|
line-length = 120
|
|
143
155
|
|
|
144
156
|
# Allow unused variables when underscore-prefixed.
|
|
145
|
-
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
|
|
157
|
+
lint.dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
|
|
146
158
|
|
|
147
159
|
# Assume Python 3.12
|
|
148
160
|
target-version = "py312"
|
|
@@ -162,10 +174,6 @@ line-ending = "auto"
|
|
|
162
174
|
|
|
163
175
|
[tool.tox]
|
|
164
176
|
legacy_tox_ini = """
|
|
165
|
-
[tox]
|
|
166
|
-
envlist = py{38,39,310,311}-django{32,41,42}
|
|
167
|
-
isolated_build = True
|
|
168
|
-
|
|
169
177
|
[testenv]
|
|
170
178
|
# Django deprecation overview: https://www.djangoproject.com/download/
|
|
171
179
|
deps =
|
|
@@ -177,7 +185,6 @@ commands =
|
|
|
177
185
|
|
|
178
186
|
[gh-actions]
|
|
179
187
|
python =
|
|
180
|
-
3.8: py38
|
|
181
188
|
3.9: py39
|
|
182
189
|
3.10: py310
|
|
183
190
|
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.1.0}/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.1.0}/e2e/cypress/plugins/index.js
RENAMED
|
File without changes
|
|
File without changes
|
{django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/e2e/cypress/support/index.js
RENAMED
|
File without changes
|
{django_dynamic_admin_forms-3.0.3 → django_dynamic_admin_forms-3.1.0}/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.1.0}/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.1.0}/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.1.0}/tests/test_admin_generic.py
RENAMED
|
File without changes
|