Metadata-Version: 2.1
Name: django-interactive-models
Version: 0.2.1
Summary: a CLI Tool to create django models interactively
Author-email: Ferran Jovell <ferran.jovell+gh@gmail.com>
License: MIT License        
        Copyright (c) 2022 Ferran Jovell        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.        
Keywords: django
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Utilities
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: Django (>=3.2.15)
Provides-Extra: test
Requires-Dist: pytest ; extra == 'test'
Requires-Dist: pytest-cov ; extra == 'test'
Requires-Dist: pytest-django ; extra == 'test'
Requires-Dist: mypy (<=0.970) ; extra == 'test'
Requires-Dist: django-stubs[compatible-mypy] ; extra == 'test'

# 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:

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

Then, you can finally run the `models` command like:

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

Check the usage by using the `-h` flag.

For example, this command:

```console
./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

```console
pip install ".[test]"
```

Then, run tests using pytest with:

```console
pytest -v
```
