@rg3915
copier.readthedocs.io
$ copier copy \
path/to/project/template \
path/to/destination$ copier copy \
--vcs-ref=main \
https://github.com/rg3915/copier-django-template.git \
~/sua_pasta/django_ninja_example$ python manage.py ninja_scaffold \
crm \ # app_name
Person \ # model_name
name:charfield \ # campos
email:emailfield \
age:integerfield$ python manage.py ninja_scaffold \
--generate-from-model crm PersonGenerate schemas, API and admin from existing model:
The command automatically generates:
models.py - Django model with specified fieldsschemas.py - Django Ninja schemas (input/output)api.py - Complete CRUD routes (GET, POST, PATCH, DELETE)admin.py - Django admin interfaceapps.py - App configuration with correct project pathsettings.py - Adds app to INSTALLED_APPSapi.py - Adds router to main APISupported field types:
charfield, textfield, integerfield, booleanfield
decimalfield, datefield, datetimefield
emailfield, urlfield, slugfield, uuidfield
filefield, imagefield
jsonfield, foreignkey, manytomanyfield, onetoone
v2.0