Install
Name Rule
- app_name: snake case
- model_name: camel case single/plural
- field_name: snake case
Usage
- generate angular codes
# declare model by pydantic, must single(User) not plural(Users)
class User(BaseModel):
id: int
username: str
password: Optional[str] = None
firstname: str
lastname: str
nickname: str = ''
gender: str
birthday: str
role: str
email: str
mobile: str
address: str
active: int
created: datetime
# declare model admin
class UserAdmin(ModelAdmin):
model_fields = ('id', 'username', 'lastname', 'firstname', 'gender', 'birthday', 'role', 'active', 'created')
list_display_restraint = model_fields
list_editable_restraint = ('username', 'gender')
model_edit_fields = ('username', 'lastname', 'firstname', 'gender', 'birthday', 'role', 'active')
model_create_fields = model_edit_fields
model_translate_fields = ('ID', '用户名', '姓氏', '名字', '性别', '生日', '角色', '是否激活', '创建时间')
# generate angular codes
mr = ModelRegister(model_admin=UserAdmin, model=User, app_name='first')
mr.register()
# copy all files to angular src/app
- add module to imports in app.module.ts or add module router to imports in app-routing.module.ts
frontend
once
- install
ng new project-name --no-standalone
ng add ng-zorro-antd
npm install dayjs
code
- env
ng g environments # angular17
# set backend: 'http://localhost:8000'
- config icon
- angular.json
"styles": [
"node_modules/ng-zorro-antd/ng-zorro-antd.min.css",
"src/styles.css"
],
- app.component.html
<router-outlet></router-outlet>
module
- add module to imports in app.module.ts
- or add module router to imports in app-routing.module.ts
- 0.3.0 Generate angular and rust axum codes
Release files for AngularCurdGen 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| angularcurdgen-0.3.0.tar.gz | 26.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| AngularCurdGen-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 71.3 kB
Release files / angularcurdgen-0.3.0.tar.gz
| Download URL | angularcurdgen-0.3.0.tar.gz |
|---|---|
| Size | 26.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f918c3e91e701008deb4ffbeecef9a6f5a23b08568acef9f2f6e21cbae701f51
|
|
BLAKE2b-256 checksum How to use checksums |
e639f3ce43b53d8cfc66718527b3812ae9842848e039a4a5174fdd946af8eccd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.11.9
|
Release files / AngularCurdGen-0.3.0-py3-none-any.whl
| Download URL | AngularCurdGen-0.3.0-py3-none-any.whl |
|---|---|
| Size | 44.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1635dbbc1c078bd511c0c79bf3baeb379d50801947b112b499d73c445aced6d4
|
|
BLAKE2b-256 checksum How to use checksums |
464daf4d876ed5e2959e9af9bb72b260e1c8114612ebe78d01646a9718025e00
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.11.9
|