Use for generate angular curd codes.
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
angularcurdgen-0.3.0.tar.gz
(26.7 kB
view details)
Built Distribution
File details
Details for the file angularcurdgen-0.3.0.tar.gz
.
File metadata
- Download URL: angularcurdgen-0.3.0.tar.gz
- Upload date:
- Size: 26.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f918c3e91e701008deb4ffbeecef9a6f5a23b08568acef9f2f6e21cbae701f51 |
|
MD5 | 7dad356f008c612266e4ba9087971f55 |
|
BLAKE2b-256 | e639f3ce43b53d8cfc66718527b3812ae9842848e039a4a5174fdd946af8eccd |
File details
Details for the file AngularCurdGen-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: AngularCurdGen-0.3.0-py3-none-any.whl
- Upload date:
- Size: 44.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1635dbbc1c078bd511c0c79bf3baeb379d50801947b112b499d73c445aced6d4 |
|
MD5 | 2e7ada7273ba7184be411cc3d030ead9 |
|
BLAKE2b-256 | 464daf4d876ed5e2959e9af9bb72b260e1c8114612ebe78d01646a9718025e00 |