Skip to main content

Django scaffold like in Ruby on Rails

Project description

Manny

Django cli add-on for generating apps, models, serializers, views, urls

Installation

Install with pip:

$ pip install manny

Then add it to your INSTALLED_APPS.

INSTALLED_APPS = (
    ...
    'rest_framework',
    'scaffold',
    ...
)

Usage

To create multiple apps at once, run the following command, where args are future app names:

$ python manage.py scaffold-app app1 app2 ...

To create models, serializers, views, urls, run the following command:

$ python manage.py scaffold {app_name} {options}
Option
-m, --model {fields} Add a model with specific fields. Default fields: update_date, create_date
-s, --serializers {model_names} Add a new serializer for the specific model; by default for all models
-vi, --views {model_names} Add a view for the specific model; by default for all models
-u Add urls for all models

To create models, use the following syntax:

$ python manage.py scaffold {app_name} -m {model_name} title:Char:255 books:Foreign::CASCADE

To specify a field, you must pass the arguments in this order:

NAME:FIELD_TYPE:FIELD_OPTIONS(only required)

Field options are optional because there are default values.
Result:

class Book(models.Model):
    title = models.CharField(max_length=255)
    books = models.ForeignKey("self", on_delete=models.CASCADE)
    update_date = models.DateTimeField(auto_now=True)
    create_date = models.DateTimeField(auto_now_add=True)

    class Meta:
        ordering = ["-id"]

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

manny-0.1.4.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

manny-0.1.4-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file manny-0.1.4.tar.gz.

File metadata

  • Download URL: manny-0.1.4.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.9.0

File hashes

Hashes for manny-0.1.4.tar.gz
Algorithm Hash digest
SHA256 49eaf76bb4b08539b315d2cfb264fba6635e9a2aaea3884afd4fa32244fc26e8
MD5 199a340972e6c783359d71f34dc65869
BLAKE2b-256 deda884bfe99e3c2d51d3031e38afa282f0b0973408a372f981dc2c57ef370cc

See more details on using hashes here.

File details

Details for the file manny-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: manny-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.9.0

File hashes

Hashes for manny-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b69c7c06ed543c11ef5784610300fcc24fab0e4a8dd922cad7645856bfc3b0f4
MD5 c224c06cd49d4e14c0c05fa1013e201e
BLAKE2b-256 2c02a1092bbd3b04da2fdb17c0178c54dc8037211f79443eade7644bf031b9eb

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