Skip to main content

A package to create your Typescript Types/Models from your Django Models.

Project description

THIS MODULE BEINH IN DEVELOPMENT, IT IS NOT READY FOR USE YET. THE DOCUMENTATION MAY NOT BE ACCURATE.

Django Model to TypeScript Converter

This repository contains a utility for converting Django models into TypeScript interfaces, facilitating the development of TypeScript applications that interact with Django backends.

Key Components

modeltotypescriptconverter.py

This file contains the ModelToTypeScriptConverter class responsible for the conversion process. It includes methods for processing Django model fields, generating TypeScript interface files, and managing command-line arguments for customization.

apps.py

Defines the DjangoModelToTypescriptTypesConfig class, which configures the application and initiates the conversion process during Django's startup if certain conditions are met (based on environment variables).

Command django2ts.py

Located under management/commands, this Django management command allows for manual invocation of the conversion process from the command line or within scripts.

Usage

To use this utility in your project, you can run the Django management command django2ts to generate TypeScript interfaces. Additionally, you can customize the behavior through environment variables such as TS_APP_TO_INCLUDE, TS_PATH, TS_SEPERATED_FILES, and DJANGO2TS_VERBOSE. You can also directly use it as CLI command next to your manage.py file by using django2ts command, with the folowing options:

usage: manage.py django2ts [--app APP] [--path PATH] [--separated-files] [--verbose]

And if you want you can also directly use the ModelToTypeScriptConverter class in your own code to generate TypeScript interfaces programmatically.

Installation

pip install dajngo-models-typescript-types

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

dajngo-models-typescript-types-0.2.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file dajngo-models-typescript-types-0.2.tar.gz.

File metadata

File hashes

Hashes for dajngo-models-typescript-types-0.2.tar.gz
Algorithm Hash digest
SHA256 c1aff1d356d860d344fc1db23964f6fc985116e939769cea2e93cb6f9b0b5319
MD5 26bdf8eabbc6af937cb48d06587c82fb
BLAKE2b-256 70b4338e847d8250db6c7f41e6a1bb8891605e82d3ed85676a9f000232c032e0

See more details on using hashes here.

File details

Details for the file dajngo_models_typescript_types-0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for dajngo_models_typescript_types-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8775cb07468c879b5fac819b6092c827e86c2e217f0ff12de8906be7ab34635f
MD5 de4c3cd826c26bd8403ae4f5a4d90029
BLAKE2b-256 4679226b0540fcb73307cf4a0d9045257f4b0adc51ba750929311d3ba6e0b057

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