ae-django-utils 0.3.2__tar.gz → 0.3.3__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.
@@ -1,4 +1,4 @@
1
- <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project aedev.tpl_project V0.3.30 -->
1
+ <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project aedev.project_tpls v0.3.79 -->
2
2
  ### GNU GENERAL PUBLIC LICENSE
3
3
 
4
4
  Version 3, 29 June 2007
@@ -1,33 +1,32 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: ae_django_utils
3
- Version: 0.3.2
3
+ Version: 0.3.3
4
4
  Summary: ae namespace module portion django_utils: helpers for django projects
5
5
  Home-page: https://gitlab.com/ae-group/ae_django_utils
6
6
  Author: AndiEcker
7
7
  Author-email: aecker2@gmail.com
8
- License: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
8
+ License: GPL-3.0-or-later
9
+ Project-URL: Bug Tracker, https://gitlab.com/ae-group/ae_django_utils/-/issues
9
10
  Project-URL: Documentation, https://ae.readthedocs.io/en/latest/_autosummary/ae.django_utils.html
10
11
  Project-URL: Repository, https://gitlab.com/ae-group/ae_django_utils
11
12
  Project-URL: Source, https://ae.readthedocs.io/en/latest/_modules/ae/django_utils.html
12
13
  Keywords: configuration,development,environment,productivity
13
14
  Classifier: Development Status :: 3 - Alpha
14
- Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
15
15
  Classifier: Natural Language :: English
16
16
  Classifier: Operating System :: OS Independent
17
17
  Classifier: Programming Language :: Python
18
18
  Classifier: Programming Language :: Python :: 3
19
- Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.12
20
20
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
- Requires-Python: >=3.9
21
+ Classifier: Typing :: Typed
22
+ Requires-Python: >=3.12
22
23
  Description-Content-Type: text/markdown
23
24
  License-File: LICENSE.md
24
25
  Requires-Dist: django
25
26
  Provides-Extra: dev
26
- Requires-Dist: aedev_tpl_project; extra == "dev"
27
+ Requires-Dist: aedev_project_tpls; extra == "dev"
27
28
  Requires-Dist: ae_ae; extra == "dev"
28
29
  Requires-Dist: anybadge; extra == "dev"
29
- Requires-Dist: coverage-badge; extra == "dev"
30
- Requires-Dist: aedev_git_repo_manager; extra == "dev"
31
30
  Requires-Dist: flake8; extra == "dev"
32
31
  Requires-Dist: mypy; extra == "dev"
33
32
  Requires-Dist: pylint; extra == "dev"
@@ -35,13 +34,9 @@ Requires-Dist: pytest; extra == "dev"
35
34
  Requires-Dist: pytest-cov; extra == "dev"
36
35
  Requires-Dist: typing; extra == "dev"
37
36
  Requires-Dist: types-setuptools; extra == "dev"
38
- Requires-Dist: wheel; extra == "dev"
39
- Requires-Dist: twine; extra == "dev"
40
37
  Provides-Extra: docs
41
38
  Provides-Extra: tests
42
39
  Requires-Dist: anybadge; extra == "tests"
43
- Requires-Dist: coverage-badge; extra == "tests"
44
- Requires-Dist: aedev_git_repo_manager; extra == "tests"
45
40
  Requires-Dist: flake8; extra == "tests"
46
41
  Requires-Dist: mypy; extra == "tests"
47
42
  Requires-Dist: pylint; extra == "tests"
@@ -49,22 +44,34 @@ Requires-Dist: pytest; extra == "tests"
49
44
  Requires-Dist: pytest-cov; extra == "tests"
50
45
  Requires-Dist: typing; extra == "tests"
51
46
  Requires-Dist: types-setuptools; extra == "tests"
52
- Requires-Dist: wheel; extra == "tests"
53
- Requires-Dist: twine; extra == "tests"
54
-
55
- <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project ae.ae V0.3.94 -->
56
- <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project aedev.tpl_namespace_root V0.3.14 -->
57
- # django_utils 0.3.2
47
+ Dynamic: author
48
+ Dynamic: author-email
49
+ Dynamic: classifier
50
+ Dynamic: description
51
+ Dynamic: description-content-type
52
+ Dynamic: home-page
53
+ Dynamic: keywords
54
+ Dynamic: license
55
+ Dynamic: license-file
56
+ Dynamic: project-url
57
+ Dynamic: provides-extra
58
+ Dynamic: requires-dist
59
+ Dynamic: requires-python
60
+ Dynamic: summary
61
+
62
+ <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project ae.ae v0.3.104 -->
63
+ <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project aedev.namespace_root_tpls v0.3.31 -->
64
+ # django_utils 0.3.3
58
65
 
59
66
  [![GitLab develop](https://img.shields.io/gitlab/pipeline/ae-group/ae_django_utils/develop?logo=python)](
60
67
  https://gitlab.com/ae-group/ae_django_utils)
61
68
  [![LatestPyPIrelease](
62
- https://img.shields.io/gitlab/pipeline/ae-group/ae_django_utils/release0.3.1?logo=python)](
63
- https://gitlab.com/ae-group/ae_django_utils/-/tree/release0.3.1)
69
+ https://img.shields.io/gitlab/pipeline/ae-group/ae_django_utils/release0.3.3?logo=python)](
70
+ https://gitlab.com/ae-group/ae_django_utils/-/tree/release0.3.3)
64
71
  [![PyPIVersions](https://img.shields.io/pypi/v/ae_django_utils)](
65
72
  https://pypi.org/project/ae-django-utils/#history)
66
73
 
67
- >ae_django_utils module 0.3.2.
74
+ >ae namespace module portion django_utils: helpers for django projects.
68
75
 
69
76
  [![Coverage](https://ae-group.gitlab.io/ae_django_utils/coverage.svg)](
70
77
  https://ae-group.gitlab.io/ae_django_utils/coverage/index.html)
@@ -89,8 +96,8 @@ Requires-Dist: twine; extra == "tests"
89
96
  https://pypi.org/project/ae-django-utils/#files)
90
97
 
91
98
 
92
- ## installation
93
99
 
100
+ ## installation
94
101
 
95
102
  execute the following command to install the
96
103
  ae.django_utils module
@@ -108,13 +115,17 @@ following command in the root folder of this repository
108
115
  (ae_django_utils):
109
116
 
110
117
  ```shell script
111
- pip install -e .[dev]
118
+ pip install --editable .[dev]
112
119
  ```
113
120
 
114
- the last command will install this module portion, along with the tools you need
115
- to develop and run tests or to extend the portion documentation. to contribute only to the unit tests or to the
116
- documentation of this portion, replace the setup extras key `dev` in the above command with `tests` or `docs`
117
- respectively.
121
+ this command installs this module portion project
122
+ along with the necessary tools to modify the source code,
123
+ run unit tests, and build documentation. to install only
124
+ the dependencies required for a specific task, replace
125
+ `dev` with one of the following:
126
+
127
+ * `tests`: for contributing to the unit test suite
128
+ * `docs`: for maintaining and building documentation
118
129
 
119
130
  more detailed explanations on how to contribute to this project
120
131
  [are available here](
@@ -123,7 +134,9 @@ https://gitlab.com/ae-group/ae_django_utils/-/blob/develop/CONTRIBUTING.rst)
123
134
 
124
135
  ## namespace portion documentation
125
136
 
126
- information on the features and usage of this portion are available at
137
+ the documentation of the source code of this portion is available at
127
138
  [ReadTheDocs](
128
139
  https://ae.readthedocs.io/en/latest/_autosummary/ae.django_utils.html
129
140
  "ae_django_utils documentation").
141
+
142
+
@@ -1,16 +1,16 @@
1
- <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project ae.ae V0.3.94 -->
2
- <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project aedev.tpl_namespace_root V0.3.14 -->
3
- # django_utils 0.3.2
1
+ <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project ae.ae v0.3.104 -->
2
+ <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project aedev.namespace_root_tpls v0.3.31 -->
3
+ # django_utils 0.3.3
4
4
 
5
5
  [![GitLab develop](https://img.shields.io/gitlab/pipeline/ae-group/ae_django_utils/develop?logo=python)](
6
6
  https://gitlab.com/ae-group/ae_django_utils)
7
7
  [![LatestPyPIrelease](
8
- https://img.shields.io/gitlab/pipeline/ae-group/ae_django_utils/release0.3.1?logo=python)](
9
- https://gitlab.com/ae-group/ae_django_utils/-/tree/release0.3.1)
8
+ https://img.shields.io/gitlab/pipeline/ae-group/ae_django_utils/release0.3.3?logo=python)](
9
+ https://gitlab.com/ae-group/ae_django_utils/-/tree/release0.3.3)
10
10
  [![PyPIVersions](https://img.shields.io/pypi/v/ae_django_utils)](
11
11
  https://pypi.org/project/ae-django-utils/#history)
12
12
 
13
- >ae_django_utils module 0.3.2.
13
+ >ae namespace module portion django_utils: helpers for django projects.
14
14
 
15
15
  [![Coverage](https://ae-group.gitlab.io/ae_django_utils/coverage.svg)](
16
16
  https://ae-group.gitlab.io/ae_django_utils/coverage/index.html)
@@ -35,8 +35,8 @@
35
35
  https://pypi.org/project/ae-django-utils/#files)
36
36
 
37
37
 
38
- ## installation
39
38
 
39
+ ## installation
40
40
 
41
41
  execute the following command to install the
42
42
  ae.django_utils module
@@ -54,13 +54,17 @@ following command in the root folder of this repository
54
54
  (ae_django_utils):
55
55
 
56
56
  ```shell script
57
- pip install -e .[dev]
57
+ pip install --editable .[dev]
58
58
  ```
59
59
 
60
- the last command will install this module portion, along with the tools you need
61
- to develop and run tests or to extend the portion documentation. to contribute only to the unit tests or to the
62
- documentation of this portion, replace the setup extras key `dev` in the above command with `tests` or `docs`
63
- respectively.
60
+ this command installs this module portion project
61
+ along with the necessary tools to modify the source code,
62
+ run unit tests, and build documentation. to install only
63
+ the dependencies required for a specific task, replace
64
+ `dev` with one of the following:
65
+
66
+ * `tests`: for contributing to the unit test suite
67
+ * `docs`: for maintaining and building documentation
64
68
 
65
69
  more detailed explanations on how to contribute to this project
66
70
  [are available here](
@@ -69,7 +73,9 @@ https://gitlab.com/ae-group/ae_django_utils/-/blob/develop/CONTRIBUTING.rst)
69
73
 
70
74
  ## namespace portion documentation
71
75
 
72
- information on the features and usage of this portion are available at
76
+ the documentation of the source code of this portion is available at
73
77
  [ReadTheDocs](
74
78
  https://ae.readthedocs.io/en/latest/_autosummary/ae.django_utils.html
75
79
  "ae_django_utils documentation").
80
+
81
+
@@ -5,20 +5,20 @@ helpers for django projects
5
5
  this module is providing helper functions for your django projects.
6
6
 
7
7
  """
8
- from typing import Any, Optional, Type
8
+ from typing import Any
9
9
  from urllib.parse import urlparse, urlunparse
10
10
 
11
11
  from django.db import models # type: ignore
12
12
  from django.utils.translation import get_language # type: ignore
13
13
 
14
14
 
15
- __version__ = '0.3.2'
15
+ __version__ = '0.3.3'
16
16
 
17
17
 
18
- def ensure_record(model: Type[models.Model], defaults: Optional[dict[str, Any]] = None, **field_values) -> models.Model:
18
+ def ensure_record(model: type[models.Model], defaults: dict[str, Any] | None = None, **field_values) -> models.Model:
19
19
  """ determine db record matching the passed field values and create it if not found.
20
20
 
21
- :param model: the model to get a create a record for.
21
+ :param model: the model to get or create a record for.
22
22
  :param defaults: additional field values.
23
23
  :param field_values: field values to identify the record to get/create.
24
24
  :return: found or created db record (model instance)
@@ -61,8 +61,8 @@ def set_url_part(url: str, fragment: str = "", query: str = "", **set_part_value
61
61
 
62
62
  if set_part_values:
63
63
  url_parts = urlparse(url)
64
- # noinspection PyProtectedMember
65
64
  url_parts = url_parts._replace(**set_part_values)
66
65
  url = urlunparse(url_parts)
67
66
 
67
+ # noinspection PyTypeChecker
68
68
  return url
@@ -1,33 +1,32 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: ae_django_utils
3
- Version: 0.3.2
3
+ Version: 0.3.3
4
4
  Summary: ae namespace module portion django_utils: helpers for django projects
5
5
  Home-page: https://gitlab.com/ae-group/ae_django_utils
6
6
  Author: AndiEcker
7
7
  Author-email: aecker2@gmail.com
8
- License: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
8
+ License: GPL-3.0-or-later
9
+ Project-URL: Bug Tracker, https://gitlab.com/ae-group/ae_django_utils/-/issues
9
10
  Project-URL: Documentation, https://ae.readthedocs.io/en/latest/_autosummary/ae.django_utils.html
10
11
  Project-URL: Repository, https://gitlab.com/ae-group/ae_django_utils
11
12
  Project-URL: Source, https://ae.readthedocs.io/en/latest/_modules/ae/django_utils.html
12
13
  Keywords: configuration,development,environment,productivity
13
14
  Classifier: Development Status :: 3 - Alpha
14
- Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
15
15
  Classifier: Natural Language :: English
16
16
  Classifier: Operating System :: OS Independent
17
17
  Classifier: Programming Language :: Python
18
18
  Classifier: Programming Language :: Python :: 3
19
- Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.12
20
20
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
- Requires-Python: >=3.9
21
+ Classifier: Typing :: Typed
22
+ Requires-Python: >=3.12
22
23
  Description-Content-Type: text/markdown
23
24
  License-File: LICENSE.md
24
25
  Requires-Dist: django
25
26
  Provides-Extra: dev
26
- Requires-Dist: aedev_tpl_project; extra == "dev"
27
+ Requires-Dist: aedev_project_tpls; extra == "dev"
27
28
  Requires-Dist: ae_ae; extra == "dev"
28
29
  Requires-Dist: anybadge; extra == "dev"
29
- Requires-Dist: coverage-badge; extra == "dev"
30
- Requires-Dist: aedev_git_repo_manager; extra == "dev"
31
30
  Requires-Dist: flake8; extra == "dev"
32
31
  Requires-Dist: mypy; extra == "dev"
33
32
  Requires-Dist: pylint; extra == "dev"
@@ -35,13 +34,9 @@ Requires-Dist: pytest; extra == "dev"
35
34
  Requires-Dist: pytest-cov; extra == "dev"
36
35
  Requires-Dist: typing; extra == "dev"
37
36
  Requires-Dist: types-setuptools; extra == "dev"
38
- Requires-Dist: wheel; extra == "dev"
39
- Requires-Dist: twine; extra == "dev"
40
37
  Provides-Extra: docs
41
38
  Provides-Extra: tests
42
39
  Requires-Dist: anybadge; extra == "tests"
43
- Requires-Dist: coverage-badge; extra == "tests"
44
- Requires-Dist: aedev_git_repo_manager; extra == "tests"
45
40
  Requires-Dist: flake8; extra == "tests"
46
41
  Requires-Dist: mypy; extra == "tests"
47
42
  Requires-Dist: pylint; extra == "tests"
@@ -49,22 +44,34 @@ Requires-Dist: pytest; extra == "tests"
49
44
  Requires-Dist: pytest-cov; extra == "tests"
50
45
  Requires-Dist: typing; extra == "tests"
51
46
  Requires-Dist: types-setuptools; extra == "tests"
52
- Requires-Dist: wheel; extra == "tests"
53
- Requires-Dist: twine; extra == "tests"
54
-
55
- <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project ae.ae V0.3.94 -->
56
- <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project aedev.tpl_namespace_root V0.3.14 -->
57
- # django_utils 0.3.2
47
+ Dynamic: author
48
+ Dynamic: author-email
49
+ Dynamic: classifier
50
+ Dynamic: description
51
+ Dynamic: description-content-type
52
+ Dynamic: home-page
53
+ Dynamic: keywords
54
+ Dynamic: license
55
+ Dynamic: license-file
56
+ Dynamic: project-url
57
+ Dynamic: provides-extra
58
+ Dynamic: requires-dist
59
+ Dynamic: requires-python
60
+ Dynamic: summary
61
+
62
+ <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project ae.ae v0.3.104 -->
63
+ <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project aedev.namespace_root_tpls v0.3.31 -->
64
+ # django_utils 0.3.3
58
65
 
59
66
  [![GitLab develop](https://img.shields.io/gitlab/pipeline/ae-group/ae_django_utils/develop?logo=python)](
60
67
  https://gitlab.com/ae-group/ae_django_utils)
61
68
  [![LatestPyPIrelease](
62
- https://img.shields.io/gitlab/pipeline/ae-group/ae_django_utils/release0.3.1?logo=python)](
63
- https://gitlab.com/ae-group/ae_django_utils/-/tree/release0.3.1)
69
+ https://img.shields.io/gitlab/pipeline/ae-group/ae_django_utils/release0.3.3?logo=python)](
70
+ https://gitlab.com/ae-group/ae_django_utils/-/tree/release0.3.3)
64
71
  [![PyPIVersions](https://img.shields.io/pypi/v/ae_django_utils)](
65
72
  https://pypi.org/project/ae-django-utils/#history)
66
73
 
67
- >ae_django_utils module 0.3.2.
74
+ >ae namespace module portion django_utils: helpers for django projects.
68
75
 
69
76
  [![Coverage](https://ae-group.gitlab.io/ae_django_utils/coverage.svg)](
70
77
  https://ae-group.gitlab.io/ae_django_utils/coverage/index.html)
@@ -89,8 +96,8 @@ Requires-Dist: twine; extra == "tests"
89
96
  https://pypi.org/project/ae-django-utils/#files)
90
97
 
91
98
 
92
- ## installation
93
99
 
100
+ ## installation
94
101
 
95
102
  execute the following command to install the
96
103
  ae.django_utils module
@@ -108,13 +115,17 @@ following command in the root folder of this repository
108
115
  (ae_django_utils):
109
116
 
110
117
  ```shell script
111
- pip install -e .[dev]
118
+ pip install --editable .[dev]
112
119
  ```
113
120
 
114
- the last command will install this module portion, along with the tools you need
115
- to develop and run tests or to extend the portion documentation. to contribute only to the unit tests or to the
116
- documentation of this portion, replace the setup extras key `dev` in the above command with `tests` or `docs`
117
- respectively.
121
+ this command installs this module portion project
122
+ along with the necessary tools to modify the source code,
123
+ run unit tests, and build documentation. to install only
124
+ the dependencies required for a specific task, replace
125
+ `dev` with one of the following:
126
+
127
+ * `tests`: for contributing to the unit test suite
128
+ * `docs`: for maintaining and building documentation
118
129
 
119
130
  more detailed explanations on how to contribute to this project
120
131
  [are available here](
@@ -123,7 +134,9 @@ https://gitlab.com/ae-group/ae_django_utils/-/blob/develop/CONTRIBUTING.rst)
123
134
 
124
135
  ## namespace portion documentation
125
136
 
126
- information on the features and usage of this portion are available at
137
+ the documentation of the source code of this portion is available at
127
138
  [ReadTheDocs](
128
139
  https://ae.readthedocs.io/en/latest/_autosummary/ae.django_utils.html
129
140
  "ae_django_utils documentation").
141
+
142
+
@@ -1,5 +1,6 @@
1
1
  LICENSE.md
2
2
  README.md
3
+ pyproject.toml
3
4
  setup.py
4
5
  ae/django_utils.py
5
6
  ae_django_utils.egg-info/PKG-INFO
@@ -1,11 +1,9 @@
1
1
  django
2
2
 
3
3
  [dev]
4
- aedev_tpl_project
4
+ aedev_project_tpls
5
5
  ae_ae
6
6
  anybadge
7
- coverage-badge
8
- aedev_git_repo_manager
9
7
  flake8
10
8
  mypy
11
9
  pylint
@@ -13,15 +11,11 @@ pytest
13
11
  pytest-cov
14
12
  typing
15
13
  types-setuptools
16
- wheel
17
- twine
18
14
 
19
15
  [docs]
20
16
 
21
17
  [tests]
22
18
  anybadge
23
- coverage-badge
24
- aedev_git_repo_manager
25
19
  flake8
26
20
  mypy
27
21
  pylint
@@ -29,5 +23,3 @@ pytest
29
23
  pytest-cov
30
24
  typing
31
25
  types-setuptools
32
- wheel
33
- twine
@@ -0,0 +1,4 @@
1
+ # THIS FILE IS EXCLUSIVELY MAINTAINED by the project aedev.project_tpls v0.3.79
2
+ [build-system]
3
+ requires = ["setuptools>=42", "wheel"]
4
+ build-backend = "setuptools.build_meta"
@@ -0,0 +1,84 @@
1
+ # THIS FILE IS EXCLUSIVELY MAINTAINED by the project aedev.project_tpls v0.3.79
2
+ """ setup of ae namespace module portion django_utils: helpers for django projects. """
3
+ import sys
4
+ # noinspection PyUnresolvedReferences
5
+ import pathlib
6
+ # noinspection PyUnresolvedReferences
7
+ import setuptools
8
+
9
+
10
+ print("SetUp " + __name__ + ": " + sys.executable + str(sys.argv) + f" {sys.path=}")
11
+
12
+ setup_kwargs = {
13
+ 'author': 'AndiEcker',
14
+ 'author_email': 'aecker2@gmail.com',
15
+ 'classifiers': [
16
+ 'Development Status :: 3 - Alpha',
17
+ 'Natural Language :: English',
18
+ 'Operating System :: OS Independent',
19
+ 'Programming Language :: Python',
20
+ 'Programming Language :: Python :: 3',
21
+ 'Programming Language :: Python :: 3.12',
22
+ 'Topic :: Software Development :: Libraries :: Python Modules',
23
+ 'Typing :: Typed',
24
+ ],
25
+ 'description': 'ae namespace module portion django_utils: helpers for django projects',
26
+ 'extras_require': {
27
+ 'dev': [
28
+ 'aedev_project_tpls',
29
+ 'ae_ae',
30
+ 'anybadge',
31
+ 'flake8',
32
+ 'mypy',
33
+ 'pylint',
34
+ 'pytest',
35
+ 'pytest-cov',
36
+ 'typing',
37
+ 'types-setuptools',
38
+ ],
39
+ 'docs': [],
40
+ 'tests': [
41
+ 'anybadge',
42
+ 'flake8',
43
+ 'mypy',
44
+ 'pylint',
45
+ 'pytest',
46
+ 'pytest-cov',
47
+ 'typing',
48
+ 'types-setuptools',
49
+ ],
50
+ },
51
+ 'install_requires': [
52
+ 'django',
53
+ ],
54
+ 'keywords': [
55
+ 'configuration',
56
+ 'development',
57
+ 'environment',
58
+ 'productivity',
59
+ ],
60
+ 'license': 'GPL-3.0-or-later',
61
+ 'long_description': (pathlib.Path(__file__).parent / 'README.md').read_text(encoding='utf-8'),
62
+ 'long_description_content_type': 'text/markdown',
63
+ 'name': 'ae_django_utils',
64
+ 'package_data': {
65
+ '': [],
66
+ },
67
+ 'packages': [
68
+ 'ae',
69
+ ],
70
+ 'project_urls': {
71
+ 'Bug Tracker': 'https://gitlab.com/ae-group/ae_django_utils/-/issues',
72
+ 'Documentation': 'https://ae.readthedocs.io/en/latest/_autosummary/ae.django_utils.html',
73
+ 'Repository': 'https://gitlab.com/ae-group/ae_django_utils',
74
+ 'Source': 'https://ae.readthedocs.io/en/latest/_modules/ae/django_utils.html',
75
+ },
76
+ 'python_requires': '>=3.12',
77
+ 'url': 'https://gitlab.com/ae-group/ae_django_utils',
78
+ 'version': '0.3.3',
79
+ 'zip_safe': True,
80
+ }
81
+
82
+ if __name__ == "__main__":
83
+ setuptools.setup(**setup_kwargs)
84
+ pass
@@ -1,13 +1,32 @@
1
1
  """ ae.django_utils unit tests. """
2
+ from unittest.mock import MagicMock
3
+
2
4
  from django.conf import settings
3
5
  from django.test.utils import override_settings
4
6
 
5
- from ae.django_utils import generic_language, requested_language, set_url_part
7
+
8
+ from ae.django_utils import ensure_record, generic_language, requested_language, set_url_part
6
9
 
7
10
 
8
11
  settings.configure()
9
12
 
10
13
 
14
+ class TestModelHelpers:
15
+ def test_ensure_record(self):
16
+ mock_instance = MagicMock()
17
+ mock_model = MagicMock()
18
+ mock_model.objects.get_or_create.return_value = (mock_instance, True)
19
+ add_fields = {'tst_field1_to_add': "Tst Val To Add", 'tst_field2_to_add': "Tst Val2 To Add"}
20
+ search_fields = {'tst_field': "Tst Field Value", 'tst_fld2': "another search value"}
21
+
22
+ # noinspection PyTypeChecker
23
+ result = ensure_record(mock_model, defaults=add_fields, **search_fields)
24
+
25
+ assert result is mock_instance
26
+ mock_model.objects.get_or_create.assert_called_once_with(
27
+ defaults=add_fields, tst_field="Tst Field Value", tst_fld2="another search value")
28
+
29
+
11
30
  class TestLanguageHelpers:
12
31
  def test_generic_language(self):
13
32
  assert generic_language('') == ''
@@ -1,18 +0,0 @@
1
- # THIS FILE IS EXCLUSIVELY MAINTAINED by the project aedev.tpl_project V0.3.30
2
- """ setup this project with setuptools and aedev.setup_project. """
3
- import pprint
4
- import sys
5
-
6
- import setuptools
7
-
8
- from aedev.setup_project import project_env_vars # type: ignore
9
-
10
- pev = project_env_vars(from_setup=True)
11
-
12
- if __name__ == "__main__":
13
- print("# EXECUTING SETUPTOOLS SETUP: argv, kwargs ###################")
14
- print(pprint.pformat(sys.argv, indent=3, width=75, compact=True))
15
- setup_kwargs = pev['setup_kwargs']
16
- print(pprint.pformat(setup_kwargs, indent=3, width=75, compact=True))
17
- setuptools.setup(**setup_kwargs)
18
- print("# FINISHED SETUPTOOLS SETUP ##################################")