Skip to main content

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

  1. add module to imports in app.module.ts
  2. or add module router to imports in app-routing.module.ts
  • 0.3.0 Generate angular and rust axum codes

Project details


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)

Uploaded Source

Built Distribution

AngularCurdGen-0.3.0-py3-none-any.whl (44.6 kB view details)

Uploaded Python 3

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

Hashes for angularcurdgen-0.3.0.tar.gz
Algorithm Hash digest
SHA256 f918c3e91e701008deb4ffbeecef9a6f5a23b08568acef9f2f6e21cbae701f51
MD5 7dad356f008c612266e4ba9087971f55
BLAKE2b-256 e639f3ce43b53d8cfc66718527b3812ae9842848e039a4a5174fdd946af8eccd

See more details on using hashes here.

File details

Details for the file AngularCurdGen-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for AngularCurdGen-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1635dbbc1c078bd511c0c79bf3baeb379d50801947b112b499d73c445aced6d4
MD5 2e7ada7273ba7184be411cc3d030ead9
BLAKE2b-256 464daf4d876ed5e2959e9af9bb72b260e1c8114612ebe78d01646a9718025e00

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page