Skip to main content

a CLI Tool to create django models interactively

Project description

Django Interactive Models

This app provides a CLI through the manage.py script to create models from the command line.

Usage:

Install the package into the virtualenv:

pip install django-interactive-models

Then, add the app to the INSTALLED_APPS in settings:

INSTALLED_APPS = [
    ...
    "interactive_models",
    ...
]

Then, you can finally run the models command like:

./manage.py models <app_name> <model_name> <field_name>:<field_type> ...

Check the usage by using the -h flag.

For example, this command:

./manage.py models my_app MyModel number:int text:text page_url:url creation_date:datetime

Will create a models.py file inside my_app with the fields number, text, page_url, creation_date with their corresponding django database fields.

Field types available:

This is the current list of accepted types and their mappings

  • auto -> AutoField,
  • bool -> BooleanField,
  • char -> CharField,
  • date -> DateField,
  • datetime -> DateTimeField,
  • email -> EmailField,
  • float -> FloatField,
  • int -> IntegerField,
  • slug -> SlugField,
  • text -> TextField,
  • time -> TimeField,
  • url -> URLField,
  • uuid -> UUIDField,

Running tests locally

Install test dependencies with

pip install ".[test]"

Then, run tests using pytest with:

pytest -v

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_interactive_models-0.3.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for django_interactive_models-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4e86317e8666a21b7b0f2c969a84704700897b350d14bc34256d97bdf95b4068
MD5 89dcd47dd9ef1788da274d10de666c2e
BLAKE2b-256 ca1207457b586db0b16fef5038c91613e7e06a7650ad31069964fec15e98da63

See more details on using hashes here.

Supported by

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