django-angular3 0.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_angular3-0.1.0/LICENSE +21 -0
- django_angular3-0.1.0/MANIFEST.in +5 -0
- django_angular3-0.1.0/PKG-INFO +296 -0
- django_angular3-0.1.0/README.md +258 -0
- django_angular3-0.1.0/django_angular3/__init__.py +5 -0
- django_angular3-0.1.0/django_angular3/__main__.py +4 -0
- django_angular3-0.1.0/django_angular3/admin.py +4 -0
- django_angular3-0.1.0/django_angular3/angular.py +335 -0
- django_angular3-0.1.0/django_angular3/apps.py +7 -0
- django_angular3-0.1.0/django_angular3/build.py +66 -0
- django_angular3-0.1.0/django_angular3/cli.py +313 -0
- django_angular3-0.1.0/django_angular3/config.py +110 -0
- django_angular3-0.1.0/django_angular3/documents.py +52 -0
- django_angular3-0.1.0/django_angular3/examples/01_simple_crm/django-angular3.json +10 -0
- django_angular3-0.1.0/django_angular3/examples/01_simple_crm/manage.py +23 -0
- django_angular3-0.1.0/django_angular3/examples/01_simple_crm/shop/__init__.py +0 -0
- django_angular3-0.1.0/django_angular3/examples/01_simple_crm/shop/admin.py +17 -0
- django_angular3-0.1.0/django_angular3/examples/01_simple_crm/shop/apps.py +6 -0
- django_angular3-0.1.0/django_angular3/examples/01_simple_crm/shop/models.py +20 -0
- django_angular3-0.1.0/django_angular3/examples/01_simple_crm/shop/serializers.py +15 -0
- django_angular3-0.1.0/django_angular3/examples/01_simple_crm/shop/tests.py +1 -0
- django_angular3-0.1.0/django_angular3/examples/01_simple_crm/shop/views.py +24 -0
- django_angular3-0.1.0/django_angular3/examples/01_simple_crm/simple_crm/__init__.py +0 -0
- django_angular3-0.1.0/django_angular3/examples/01_simple_crm/simple_crm/asgi.py +7 -0
- django_angular3-0.1.0/django_angular3/examples/01_simple_crm/simple_crm/settings.py +107 -0
- django_angular3-0.1.0/django_angular3/examples/01_simple_crm/simple_crm/urls.py +14 -0
- django_angular3-0.1.0/django_angular3/examples/01_simple_crm/simple_crm/wsgi.py +7 -0
- django_angular3-0.1.0/django_angular3/examples/01_simple_crm/ui.json +13 -0
- django_angular3-0.1.0/django_angular3/examples/__init__.py +0 -0
- django_angular3-0.1.0/django_angular3/management/__init__.py +1 -0
- django_angular3-0.1.0/django_angular3/management/commands/__init__.py +1 -0
- django_angular3-0.1.0/django_angular3/management/commands/_base.py +57 -0
- django_angular3-0.1.0/django_angular3/management/commands/build_app.py +483 -0
- django_angular3-0.1.0/django_angular3/management/commands/export_schema.py +106 -0
- django_angular3-0.1.0/django_angular3/management/commands/ng_add.py +19 -0
- django_angular3-0.1.0/django_angular3/management/commands/ng_build.py +6 -0
- django_angular3-0.1.0/django_angular3/management/commands/ng_config.py +6 -0
- django_angular3-0.1.0/django_angular3/management/commands/ng_gen_app.py +22 -0
- django_angular3-0.1.0/django_angular3/management/commands/ng_new.py +6 -0
- django_angular3-0.1.0/django_angular3/management/commands/ng_openapi_gen.py +6 -0
- django_angular3-0.1.0/django_angular3/management/commands/ng_workspace.py +6 -0
- django_angular3-0.1.0/django_angular3/management/commands/ng_workspace_delete.py +6 -0
- django_angular3-0.1.0/django_angular3/management/commands/ng_workspace_modify.py +6 -0
- django_angular3-0.1.0/django_angular3/migrations/__init__.py +2 -0
- django_angular3-0.1.0/django_angular3/models.py +2 -0
- django_angular3-0.1.0/django_angular3/settings.py +123 -0
- django_angular3-0.1.0/django_angular3/static/django_angular3/.gitkeep +0 -0
- django_angular3-0.1.0/django_angular3/templates/django_angular3/.gitkeep +0 -0
- django_angular3-0.1.0/django_angular3/tools.py +134 -0
- django_angular3-0.1.0/django_angular3/urls.py +6 -0
- django_angular3-0.1.0/django_angular3/validation.py +169 -0
- django_angular3-0.1.0/django_angular3/views.py +2 -0
- django_angular3-0.1.0/django_angular3.egg-info/PKG-INFO +296 -0
- django_angular3-0.1.0/django_angular3.egg-info/SOURCES.txt +65 -0
- django_angular3-0.1.0/django_angular3.egg-info/dependency_links.txt +1 -0
- django_angular3-0.1.0/django_angular3.egg-info/entry_points.txt +2 -0
- django_angular3-0.1.0/django_angular3.egg-info/requires.txt +16 -0
- django_angular3-0.1.0/django_angular3.egg-info/top_level.txt +1 -0
- django_angular3-0.1.0/pyproject.toml +75 -0
- django_angular3-0.1.0/requirements.txt +4 -0
- django_angular3-0.1.0/setup.cfg +4 -0
- django_angular3-0.1.0/tests/test_angular_commands.py +311 -0
- django_angular3-0.1.0/tests/test_cli_scaffold.py +81 -0
- django_angular3-0.1.0/tests/test_export_schema.py +287 -0
- django_angular3-0.1.0/tests/test_ngdj_requirements.py +146 -0
- django_angular3-0.1.0/tests/test_settings.py +13 -0
- django_angular3-0.1.0/tests/test_smoke.py +26 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Shlomo Anglister
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: django-angular3
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Contract-first integration tooling for Django REST framework and Angular Material.
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Homepage, https://djangoangular.com/
|
|
7
|
+
Project-URL: Repository, https://github.com/shlomoa/django-angular3
|
|
8
|
+
Keywords: django,djangorestframework,angular,openapi
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Framework :: Django
|
|
11
|
+
Classifier: Framework :: Django :: 5.0
|
|
12
|
+
Classifier: Framework :: Django :: 5.1
|
|
13
|
+
Classifier: Framework :: Django :: 6.0
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
21
|
+
Requires-Python: >=3.11
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: Django>=5.1
|
|
25
|
+
Requires-Dist: djangorestframework
|
|
26
|
+
Requires-Dist: django-filter
|
|
27
|
+
Requires-Dist: drf-spectacular
|
|
28
|
+
Requires-Dist: claude-agent-sdk
|
|
29
|
+
Provides-Extra: yaml
|
|
30
|
+
Requires-Dist: PyYAML>=6.0; extra == "yaml"
|
|
31
|
+
Provides-Extra: docs
|
|
32
|
+
Requires-Dist: sphinx>=8.0; extra == "docs"
|
|
33
|
+
Requires-Dist: furo>=2024.1.29; extra == "docs"
|
|
34
|
+
Requires-Dist: myst-parser>=3.0; extra == "docs"
|
|
35
|
+
Provides-Extra: dev
|
|
36
|
+
Requires-Dist: ruff>=0.4; extra == "dev"
|
|
37
|
+
Dynamic: license-file
|
|
38
|
+
|
|
39
|
+
# django-angular3
|
|
40
|
+
|
|
41
|
+
`django-angular3` enables seamless integration of Django, Django REST Framework (DRF), and Angular — giving teams a contract-first, automation-ready bridge between a DRF backend and an Angular Material frontend.
|
|
42
|
+
|
|
43
|
+
Project website: <https://djangoangular.com/>
|
|
44
|
+
|
|
45
|
+
Documentation: <https://django-angular3.readthedocs.io/>
|
|
46
|
+
|
|
47
|
+
Related docs:
|
|
48
|
+
- `doc/ARCHITECTURE.md` — architecture, integration boundaries, and design decisions
|
|
49
|
+
- `TODO.md` — implementation sequencing, delivery roadmap, and open items
|
|
50
|
+
|
|
51
|
+
It allows you to:
|
|
52
|
+
- Keep Django responsible for data, authentication, and administration.
|
|
53
|
+
- Keep Angular responsible for the end-user application and client-side route tree.
|
|
54
|
+
- Use OpenAPI as the source of truth for CRM-facing functionality.
|
|
55
|
+
- Support bespoke non-CRM pages, reactive forms, and workflows via a separate structured input source.
|
|
56
|
+
- Automate the handoff from backend API contract to Angular integration artifacts through a deterministic, repeatable pipeline.
|
|
57
|
+
|
|
58
|
+
## Requirements
|
|
59
|
+
|
|
60
|
+
See [doc/REQUIREMENTS.md](doc/REQUIREMENTS.md) for the full requirements.
|
|
61
|
+
|
|
62
|
+
## Installation
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
pip install django-angular3
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
To install from a local clone:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
pip install -e /path/to/django-angular3/
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Django app integration
|
|
75
|
+
|
|
76
|
+
If you install `django-angular3` into a Django project, add the app to
|
|
77
|
+
`INSTALLED_APPS` to enable the bundled `ng_` management commands.
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
INSTALLED_APPS = [
|
|
81
|
+
# ...
|
|
82
|
+
"django_angular3",
|
|
83
|
+
]
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Or use the explicit app config path:
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
INSTALLED_APPS = [
|
|
90
|
+
# ...
|
|
91
|
+
"django_angular3.apps.DjangoAngular3Config",
|
|
92
|
+
]
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The specialized Node/Angular tool settings live in
|
|
96
|
+
`django_angular3/settings.py` and are configured through `DJANGO_ANGULAR3` in
|
|
97
|
+
your Django project's `settings.py`. Only set the values you want to override;
|
|
98
|
+
the example below shows the full supported settings surface, including an
|
|
99
|
+
optional `config_path` override:
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
DJANGO_ANGULAR3 = {
|
|
103
|
+
"config_path": "django-angular3.json",
|
|
104
|
+
"ng_executable": "ng",
|
|
105
|
+
"pnpm_executable": "pnpm",
|
|
106
|
+
"node_executable": "node",
|
|
107
|
+
"command_allowlist": ["ng_openapi_gen"],
|
|
108
|
+
"package_manager": "pnpm",
|
|
109
|
+
"build_configuration": "production",
|
|
110
|
+
"style": "scss",
|
|
111
|
+
"routing": True,
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
The current settings surface and defaults are:
|
|
116
|
+
|
|
117
|
+
- `config_path`: `"django-angular3.json"` - default project config path used
|
|
118
|
+
when a CLI or management command path is omitted
|
|
119
|
+
- `node_executable`: `"node"`
|
|
120
|
+
- `pnpm_executable`: `"pnpm"`
|
|
121
|
+
- `ng_executable`: `"ng"`
|
|
122
|
+
- `command_allowlist`: `("ng_openapi_gen",)`
|
|
123
|
+
- `package_manager`: `"pnpm"`
|
|
124
|
+
- `build_configuration`: `"production"`
|
|
125
|
+
- `style`: `"scss"`
|
|
126
|
+
- `routing`: `True`
|
|
127
|
+
|
|
128
|
+
Legacy `npm_executable` and `npx_executable` overrides are still accepted and
|
|
129
|
+
mapped to `pnpm_executable` for compatibility with older settings modules.
|
|
130
|
+
Commands are only executed when the resolved django-angular3 command name is in
|
|
131
|
+
`command_allowlist`. The default allowlist only permits `ng_openapi_gen`.
|
|
132
|
+
|
|
133
|
+
Once installed, Django and the standalone CLI expose the same Angular command
|
|
134
|
+
resolution flow:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
./manage.py ng_new django-angular3.json --dry-run
|
|
138
|
+
./manage.py ng_workspace django-angular3.json --dry-run
|
|
139
|
+
./manage.py ng_config django-angular3.json --dry-run
|
|
140
|
+
./manage.py ng_add django-angular3.json --dry-run
|
|
141
|
+
./manage.py ng_gen_app django-angular3.json --dry-run
|
|
142
|
+
./manage.py ng_openapi_gen django-angular3.json --dry-run
|
|
143
|
+
./manage.py ng_build django-angular3.json --dry-run
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
- `ng_new` creates an empty Angular workspace
|
|
147
|
+
- `ng_workspace` runs the upstream-aligned workspace bootstrap flow: `ng new`, workspace defaults, `ng add angular-django2`, and `ng generate angular-django2:ng-workspace`
|
|
148
|
+
- `ng_config` applies workspace defaults such as package manager, style, and routing
|
|
149
|
+
- `ng_add` installs and registers the configured Angular schematic package
|
|
150
|
+
- `ng_gen_app` generates an Angular application inside the configured workspace
|
|
151
|
+
- `ng_openapi_gen` runs a locally installed `ng-openapi-gen` for the configured OpenAPI source
|
|
152
|
+
|
|
153
|
+
`ng_openapi_gen` resolves to `pnpm exec`, so it only uses dependencies that
|
|
154
|
+
are already installed in the Angular workspace. It does not download and
|
|
155
|
+
execute packages at runtime.
|
|
156
|
+
- `ng_build` builds the configured Angular application
|
|
157
|
+
|
|
158
|
+
> **Naming note**: The `ng_*` command names (e.g. `ng_workspace`, `ng_openapi_gen`) are the
|
|
159
|
+
> **frozen CLI wrapper layer** — stable entry points that never change. The automation subsystem
|
|
160
|
+
> uses two separate layers with distinct names: **TOOL contracts** are deterministic
|
|
161
|
+
> agent-callable operations (e.g. `angular_workspace_scaffold`, `openapi_schema_export`) and
|
|
162
|
+
> **SKILL names** are AI-guided session identifiers (e.g. `angular-workspace-foundation`,
|
|
163
|
+
> `angular-api-integration`). See `doc/ARCHITECTURE.md §2.23` for the authoritative definition.
|
|
164
|
+
|
|
165
|
+
If you want these commands to execute instead of only dry-run, configure the
|
|
166
|
+
command allowlist to include the django-angular3 commands you want to permit.
|
|
167
|
+
|
|
168
|
+
Use `--app-name <name>` with `ng_gen_app` to override the generated Angular
|
|
169
|
+
application name.
|
|
170
|
+
|
|
171
|
+
At the moment this reusable Django app contributes configuration helpers and
|
|
172
|
+
management commands; it does not yet ship models, URLs, templates, static
|
|
173
|
+
assets, or migrations, so there is no extra URL inclusion or migration step for
|
|
174
|
+
the package itself.
|
|
175
|
+
|
|
176
|
+
## Example
|
|
177
|
+
|
|
178
|
+
Let's take a look at a simple example of starting from Django REST framework and
|
|
179
|
+
then layering Angular Material integration on top.
|
|
180
|
+
|
|
181
|
+
Start by creating a DRF-backed project in the usual way:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
pip install djangorestframework
|
|
185
|
+
django-admin startproject mysite .
|
|
186
|
+
./manage.py migrate
|
|
187
|
+
./manage.py createsuperuser
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Now edit your project's `urls.py` module:
|
|
191
|
+
|
|
192
|
+
```python
|
|
193
|
+
from django.contrib.auth.models import User
|
|
194
|
+
from django.urls import include, path
|
|
195
|
+
from rest_framework import routers, serializers, viewsets
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
# Serializers define the API representation.
|
|
199
|
+
class UserSerializer(serializers.HyperlinkedModelSerializer):
|
|
200
|
+
class Meta:
|
|
201
|
+
model = User
|
|
202
|
+
fields = ["url", "username", "email", "is_staff"]
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
# ViewSets define the view behavior.
|
|
206
|
+
class UserViewSet(viewsets.ModelViewSet):
|
|
207
|
+
queryset = User.objects.all()
|
|
208
|
+
serializer_class = UserSerializer
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
# Routers provide a way of automatically determining the URL conf.
|
|
212
|
+
router = routers.DefaultRouter()
|
|
213
|
+
router.register(r"users", UserViewSet)
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
# Django serves API and authentication routes.
|
|
217
|
+
urlpatterns = [
|
|
218
|
+
path("api/", include(router.urls)),
|
|
219
|
+
path("api-auth/", include("rest_framework.urls", namespace="rest_framework")),
|
|
220
|
+
]
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Add the following to your `settings.py` module:
|
|
224
|
+
|
|
225
|
+
```python
|
|
226
|
+
INSTALLED_APPS = [
|
|
227
|
+
# ...
|
|
228
|
+
"rest_framework",
|
|
229
|
+
]
|
|
230
|
+
|
|
231
|
+
REST_FRAMEWORK = {
|
|
232
|
+
"DEFAULT_PERMISSION_CLASSES": [
|
|
233
|
+
"rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly",
|
|
234
|
+
]
|
|
235
|
+
}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
At this point, Django + DRF own the backend data and authentication services.
|
|
239
|
+
|
|
240
|
+
The next step is to export the OpenAPI contract from that backend and use it as
|
|
241
|
+
the source for Angular-side CRM-facing integration.
|
|
242
|
+
|
|
243
|
+
A simplified schema fragment might look like this:
|
|
244
|
+
|
|
245
|
+
```yaml
|
|
246
|
+
paths:
|
|
247
|
+
/api/users/:
|
|
248
|
+
get:
|
|
249
|
+
operationId: listUsers
|
|
250
|
+
post:
|
|
251
|
+
operationId: createUser
|
|
252
|
+
/api/users/{id}/:
|
|
253
|
+
get:
|
|
254
|
+
operationId: retrieveUser
|
|
255
|
+
patch:
|
|
256
|
+
operationId: updateUser
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Non-CRM pages and bespoke workflows are then supplied separately.
|
|
260
|
+
|
|
261
|
+
For example:
|
|
262
|
+
|
|
263
|
+
```yaml
|
|
264
|
+
pages:
|
|
265
|
+
- route: /dashboard
|
|
266
|
+
kind: dashboard
|
|
267
|
+
|
|
268
|
+
forms:
|
|
269
|
+
- id: invite-user
|
|
270
|
+
mode: reactive
|
|
271
|
+
submit:
|
|
272
|
+
action: createUser
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
The scaffolded first version in this repository already includes example inputs.
|
|
276
|
+
For the contributor workflow around local validation and build-plan generation,
|
|
277
|
+
see [Contributing](CONTRIBUTING.md).
|
|
278
|
+
|
|
279
|
+
## Documentation
|
|
280
|
+
|
|
281
|
+
Public usage documentation is not available yet. The project website is
|
|
282
|
+
available at <https://djangoangular.com/>.
|
|
283
|
+
|
|
284
|
+
Current project documents:
|
|
285
|
+
|
|
286
|
+
- [Contributing](CONTRIBUTING.md)
|
|
287
|
+
- [Releasing](doc/RELEASING.md)
|
|
288
|
+
- [Requirements](doc/REQUIREMENTS.md)
|
|
289
|
+
- [Architecture](doc/ARCHITECTURE.md)
|
|
290
|
+
|
|
291
|
+
## Status
|
|
292
|
+
|
|
293
|
+
This project now includes a first scaffolded Python package, example specs, and
|
|
294
|
+
the current contributor workflow. The repository does not yet include a
|
|
295
|
+
frontend workspace. Actual code generation and Angular assembly are still
|
|
296
|
+
pending.
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
# django-angular3
|
|
2
|
+
|
|
3
|
+
`django-angular3` enables seamless integration of Django, Django REST Framework (DRF), and Angular — giving teams a contract-first, automation-ready bridge between a DRF backend and an Angular Material frontend.
|
|
4
|
+
|
|
5
|
+
Project website: <https://djangoangular.com/>
|
|
6
|
+
|
|
7
|
+
Documentation: <https://django-angular3.readthedocs.io/>
|
|
8
|
+
|
|
9
|
+
Related docs:
|
|
10
|
+
- `doc/ARCHITECTURE.md` — architecture, integration boundaries, and design decisions
|
|
11
|
+
- `TODO.md` — implementation sequencing, delivery roadmap, and open items
|
|
12
|
+
|
|
13
|
+
It allows you to:
|
|
14
|
+
- Keep Django responsible for data, authentication, and administration.
|
|
15
|
+
- Keep Angular responsible for the end-user application and client-side route tree.
|
|
16
|
+
- Use OpenAPI as the source of truth for CRM-facing functionality.
|
|
17
|
+
- Support bespoke non-CRM pages, reactive forms, and workflows via a separate structured input source.
|
|
18
|
+
- Automate the handoff from backend API contract to Angular integration artifacts through a deterministic, repeatable pipeline.
|
|
19
|
+
|
|
20
|
+
## Requirements
|
|
21
|
+
|
|
22
|
+
See [doc/REQUIREMENTS.md](doc/REQUIREMENTS.md) for the full requirements.
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pip install django-angular3
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
To install from a local clone:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pip install -e /path/to/django-angular3/
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Django app integration
|
|
37
|
+
|
|
38
|
+
If you install `django-angular3` into a Django project, add the app to
|
|
39
|
+
`INSTALLED_APPS` to enable the bundled `ng_` management commands.
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
INSTALLED_APPS = [
|
|
43
|
+
# ...
|
|
44
|
+
"django_angular3",
|
|
45
|
+
]
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Or use the explicit app config path:
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
INSTALLED_APPS = [
|
|
52
|
+
# ...
|
|
53
|
+
"django_angular3.apps.DjangoAngular3Config",
|
|
54
|
+
]
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The specialized Node/Angular tool settings live in
|
|
58
|
+
`django_angular3/settings.py` and are configured through `DJANGO_ANGULAR3` in
|
|
59
|
+
your Django project's `settings.py`. Only set the values you want to override;
|
|
60
|
+
the example below shows the full supported settings surface, including an
|
|
61
|
+
optional `config_path` override:
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
DJANGO_ANGULAR3 = {
|
|
65
|
+
"config_path": "django-angular3.json",
|
|
66
|
+
"ng_executable": "ng",
|
|
67
|
+
"pnpm_executable": "pnpm",
|
|
68
|
+
"node_executable": "node",
|
|
69
|
+
"command_allowlist": ["ng_openapi_gen"],
|
|
70
|
+
"package_manager": "pnpm",
|
|
71
|
+
"build_configuration": "production",
|
|
72
|
+
"style": "scss",
|
|
73
|
+
"routing": True,
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
The current settings surface and defaults are:
|
|
78
|
+
|
|
79
|
+
- `config_path`: `"django-angular3.json"` - default project config path used
|
|
80
|
+
when a CLI or management command path is omitted
|
|
81
|
+
- `node_executable`: `"node"`
|
|
82
|
+
- `pnpm_executable`: `"pnpm"`
|
|
83
|
+
- `ng_executable`: `"ng"`
|
|
84
|
+
- `command_allowlist`: `("ng_openapi_gen",)`
|
|
85
|
+
- `package_manager`: `"pnpm"`
|
|
86
|
+
- `build_configuration`: `"production"`
|
|
87
|
+
- `style`: `"scss"`
|
|
88
|
+
- `routing`: `True`
|
|
89
|
+
|
|
90
|
+
Legacy `npm_executable` and `npx_executable` overrides are still accepted and
|
|
91
|
+
mapped to `pnpm_executable` for compatibility with older settings modules.
|
|
92
|
+
Commands are only executed when the resolved django-angular3 command name is in
|
|
93
|
+
`command_allowlist`. The default allowlist only permits `ng_openapi_gen`.
|
|
94
|
+
|
|
95
|
+
Once installed, Django and the standalone CLI expose the same Angular command
|
|
96
|
+
resolution flow:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
./manage.py ng_new django-angular3.json --dry-run
|
|
100
|
+
./manage.py ng_workspace django-angular3.json --dry-run
|
|
101
|
+
./manage.py ng_config django-angular3.json --dry-run
|
|
102
|
+
./manage.py ng_add django-angular3.json --dry-run
|
|
103
|
+
./manage.py ng_gen_app django-angular3.json --dry-run
|
|
104
|
+
./manage.py ng_openapi_gen django-angular3.json --dry-run
|
|
105
|
+
./manage.py ng_build django-angular3.json --dry-run
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
- `ng_new` creates an empty Angular workspace
|
|
109
|
+
- `ng_workspace` runs the upstream-aligned workspace bootstrap flow: `ng new`, workspace defaults, `ng add angular-django2`, and `ng generate angular-django2:ng-workspace`
|
|
110
|
+
- `ng_config` applies workspace defaults such as package manager, style, and routing
|
|
111
|
+
- `ng_add` installs and registers the configured Angular schematic package
|
|
112
|
+
- `ng_gen_app` generates an Angular application inside the configured workspace
|
|
113
|
+
- `ng_openapi_gen` runs a locally installed `ng-openapi-gen` for the configured OpenAPI source
|
|
114
|
+
|
|
115
|
+
`ng_openapi_gen` resolves to `pnpm exec`, so it only uses dependencies that
|
|
116
|
+
are already installed in the Angular workspace. It does not download and
|
|
117
|
+
execute packages at runtime.
|
|
118
|
+
- `ng_build` builds the configured Angular application
|
|
119
|
+
|
|
120
|
+
> **Naming note**: The `ng_*` command names (e.g. `ng_workspace`, `ng_openapi_gen`) are the
|
|
121
|
+
> **frozen CLI wrapper layer** — stable entry points that never change. The automation subsystem
|
|
122
|
+
> uses two separate layers with distinct names: **TOOL contracts** are deterministic
|
|
123
|
+
> agent-callable operations (e.g. `angular_workspace_scaffold`, `openapi_schema_export`) and
|
|
124
|
+
> **SKILL names** are AI-guided session identifiers (e.g. `angular-workspace-foundation`,
|
|
125
|
+
> `angular-api-integration`). See `doc/ARCHITECTURE.md §2.23` for the authoritative definition.
|
|
126
|
+
|
|
127
|
+
If you want these commands to execute instead of only dry-run, configure the
|
|
128
|
+
command allowlist to include the django-angular3 commands you want to permit.
|
|
129
|
+
|
|
130
|
+
Use `--app-name <name>` with `ng_gen_app` to override the generated Angular
|
|
131
|
+
application name.
|
|
132
|
+
|
|
133
|
+
At the moment this reusable Django app contributes configuration helpers and
|
|
134
|
+
management commands; it does not yet ship models, URLs, templates, static
|
|
135
|
+
assets, or migrations, so there is no extra URL inclusion or migration step for
|
|
136
|
+
the package itself.
|
|
137
|
+
|
|
138
|
+
## Example
|
|
139
|
+
|
|
140
|
+
Let's take a look at a simple example of starting from Django REST framework and
|
|
141
|
+
then layering Angular Material integration on top.
|
|
142
|
+
|
|
143
|
+
Start by creating a DRF-backed project in the usual way:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
pip install djangorestframework
|
|
147
|
+
django-admin startproject mysite .
|
|
148
|
+
./manage.py migrate
|
|
149
|
+
./manage.py createsuperuser
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Now edit your project's `urls.py` module:
|
|
153
|
+
|
|
154
|
+
```python
|
|
155
|
+
from django.contrib.auth.models import User
|
|
156
|
+
from django.urls import include, path
|
|
157
|
+
from rest_framework import routers, serializers, viewsets
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
# Serializers define the API representation.
|
|
161
|
+
class UserSerializer(serializers.HyperlinkedModelSerializer):
|
|
162
|
+
class Meta:
|
|
163
|
+
model = User
|
|
164
|
+
fields = ["url", "username", "email", "is_staff"]
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
# ViewSets define the view behavior.
|
|
168
|
+
class UserViewSet(viewsets.ModelViewSet):
|
|
169
|
+
queryset = User.objects.all()
|
|
170
|
+
serializer_class = UserSerializer
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
# Routers provide a way of automatically determining the URL conf.
|
|
174
|
+
router = routers.DefaultRouter()
|
|
175
|
+
router.register(r"users", UserViewSet)
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
# Django serves API and authentication routes.
|
|
179
|
+
urlpatterns = [
|
|
180
|
+
path("api/", include(router.urls)),
|
|
181
|
+
path("api-auth/", include("rest_framework.urls", namespace="rest_framework")),
|
|
182
|
+
]
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
Add the following to your `settings.py` module:
|
|
186
|
+
|
|
187
|
+
```python
|
|
188
|
+
INSTALLED_APPS = [
|
|
189
|
+
# ...
|
|
190
|
+
"rest_framework",
|
|
191
|
+
]
|
|
192
|
+
|
|
193
|
+
REST_FRAMEWORK = {
|
|
194
|
+
"DEFAULT_PERMISSION_CLASSES": [
|
|
195
|
+
"rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly",
|
|
196
|
+
]
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
At this point, Django + DRF own the backend data and authentication services.
|
|
201
|
+
|
|
202
|
+
The next step is to export the OpenAPI contract from that backend and use it as
|
|
203
|
+
the source for Angular-side CRM-facing integration.
|
|
204
|
+
|
|
205
|
+
A simplified schema fragment might look like this:
|
|
206
|
+
|
|
207
|
+
```yaml
|
|
208
|
+
paths:
|
|
209
|
+
/api/users/:
|
|
210
|
+
get:
|
|
211
|
+
operationId: listUsers
|
|
212
|
+
post:
|
|
213
|
+
operationId: createUser
|
|
214
|
+
/api/users/{id}/:
|
|
215
|
+
get:
|
|
216
|
+
operationId: retrieveUser
|
|
217
|
+
patch:
|
|
218
|
+
operationId: updateUser
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Non-CRM pages and bespoke workflows are then supplied separately.
|
|
222
|
+
|
|
223
|
+
For example:
|
|
224
|
+
|
|
225
|
+
```yaml
|
|
226
|
+
pages:
|
|
227
|
+
- route: /dashboard
|
|
228
|
+
kind: dashboard
|
|
229
|
+
|
|
230
|
+
forms:
|
|
231
|
+
- id: invite-user
|
|
232
|
+
mode: reactive
|
|
233
|
+
submit:
|
|
234
|
+
action: createUser
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
The scaffolded first version in this repository already includes example inputs.
|
|
238
|
+
For the contributor workflow around local validation and build-plan generation,
|
|
239
|
+
see [Contributing](CONTRIBUTING.md).
|
|
240
|
+
|
|
241
|
+
## Documentation
|
|
242
|
+
|
|
243
|
+
Public usage documentation is not available yet. The project website is
|
|
244
|
+
available at <https://djangoangular.com/>.
|
|
245
|
+
|
|
246
|
+
Current project documents:
|
|
247
|
+
|
|
248
|
+
- [Contributing](CONTRIBUTING.md)
|
|
249
|
+
- [Releasing](doc/RELEASING.md)
|
|
250
|
+
- [Requirements](doc/REQUIREMENTS.md)
|
|
251
|
+
- [Architecture](doc/ARCHITECTURE.md)
|
|
252
|
+
|
|
253
|
+
## Status
|
|
254
|
+
|
|
255
|
+
This project now includes a first scaffolded Python package, example specs, and
|
|
256
|
+
the current contributor workflow. The repository does not yet include a
|
|
257
|
+
frontend workspace. Actual code generation and Angular assembly are still
|
|
258
|
+
pending.
|