Git Product home page Git Product logo

django-generate-code's Introduction

django-generate-code

A tool that can write some code for you. Cool, yeah?

Lyricism

I indeed was jelous to see that RoR programmers can just do their rails generate and so on. It is realy not a necessary tool, but... let it be!

generate_model

Will create a new model class in models.py of your_app_name.

Command arguments

In order to create a model you need to pass:

  • application name (where models.py is located)
  • your model name
  • (optional) fields and their data types
python manage.py generate_model *your_app_name* *new_model_name* some_field:string some_other_field:int

Field types

Can translate the following 'data types' to fields:

  • string: models.CharField(min_length=255)
  • slug: models.SlugField()
  • text: models.TextField()
  • url: models.URLField()
  • integer: models.IntegerField()
  • decimal: models.DecimalField(max_digits=9, decimal_places=2)

Usage example

python manage.py generate_model_code myapp MyModel title:string price:decimal description:text

Will generate the following code in myapp/models.py:

class MyModel(models.Model):
    title = models.CharField(min_length=255)
    price = models.DecimalField(max_digits=9, decimal_places=2)
    description = models.TextField()

django-generate-code's People

Contributors

nskeip avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.