Skip to main content

Use for generate angular curd codes.

Project description

Install

Usage

  • generate angular codes
# declare model by pydantic
class Users(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 UsersAdmin(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=UsersAdmin, model=Users, 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.2.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.2.0.tar.gz (21.5 kB view details)

Uploaded Source

Built Distribution

AngularCurdGen-0.2.0-py3-none-any.whl (35.0 kB view details)

Uploaded Python 3

File details

Details for the file angularcurdgen-0.2.0.tar.gz.

File metadata

  • Download URL: angularcurdgen-0.2.0.tar.gz
  • Upload date:
  • Size: 21.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.9

File hashes

Hashes for angularcurdgen-0.2.0.tar.gz
Algorithm Hash digest
SHA256 06f5d3785cd3e6a77bb6b5c903f51af82e77eec34926a00c9f8f9c6b90b71494
MD5 d425b7043caf216df4c59e203a96ed07
BLAKE2b-256 73479da393c8fed0a0ac4a0c71936930205324b9462412df0da3ecd29694cb38

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for AngularCurdGen-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0701ab03bd346fdd0085f97637acd5974ad84153152781a4ee5487006594a4ec
MD5 a6b0af318bc9656cc6269a1b353e070a
BLAKE2b-256 edc817180cd7dcaa12fdb2b2550f6c847b5c0b4b78bc7febe014d55baae5a7e7

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