This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description
Because programmers are lazy…

Modelish is a quick attempt to save a few keystrokes. Many data modeling tools are a GUI nightmare, with dropdowns and lots of buttons. But sometimes, especially when you are sketching something out, writing out full Django models can be a bit tedious.

Modelish will parse a file with a simplified model declaration in a flavor of YAML and generate Python code for model definition.

Normally I would say source code generation is a “Bad Idea”, but really even in Python, Django models are a mostly declarative syntax


Install django-predicate:

pip install django-modelish

You can then start banging out models like this

    doc: This is the poll model
        type: char
        max_length: 200
        type: datetime
        args: date published

        type: fk
        args: [Poll]
        max_length: 200
        type: int

You then just use the CLI tool:

modelish path-to-file.yml

This will generate code like this:

class Poll(models.Model):
    """This is the poll model"""

    pub_date = models.DateTimeField(
        'date published')
    question = models.CharField(

class Choice(models.Model):
    choice_text = models.CharField(
    poll = models.ForeignKey(
    votes = models.IntegerField()


The syntax is pretty simple:

    [doc: docstring]
        [type: type-alias],
        [args: arglist],
        kwarg: value

The field type is represented by a shortened ‘type’ alias so ‘char’ becomes ‘models.CharField’ etc (see grammarish below).

The type can be specified one of two ways, either following the field name with a hyphen, or explicitly declared as a type in the field definition.

Positional args to the model specified as an explicit list in square brackets, or as a comma delimited string.

The remaining block of the field definition consists of kwarg/value pairs.

Working with grammarish

Modelish works with a grammar composed of type aliases and defaults. The standard types are:

auto: AutoField
bigint: BigIntegerField
bool: BooleanField
char: CharField
date: DateField
datetime: DateTimeField
decimal: DecimalField
email: EmailField
file: FileField
float: FloatField
image: ImageField
int: IntegerField
ip: IPAddressField
gip: GenericIPAddressField
nbool: NullBooleanField
pint: PositiveIntegerField
psint: PositiveSmallIntegerField
slug: SlugField
sint: SmallIntegerField
text: TextField
time: TimeField
url: URLField
fk: ForeignKey
m2m: ManyToManyField
timestamp: DateTimeField

For each type - a set of default kwargs is defined in the grammar as defaults:

    default: true
    max_length: 100
    blank: true
    null: true
    auto-now: true

This default grammar can be replace, or enhanced by passing your own yaml files to the command. Use --grammar to replace the default grammer, and use --extra-grammar to merge in and update the default grammer with your own additions or changes.

That’s it - this isn’t meant to be any sort of full featured model builder or data modeler, it is just a simple DSLish bootstrap tool to give you a starting point with a little less typing.

Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-modelish-0.1.tar.gz (9.4 kB) Copy SHA256 Checksum SHA256 Source Aug 18, 2012

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting