{ "info": { "author": "Preston Holmes", "author_email": "preston@ptone.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Topic :: Utilities" ], "description": "django-modelish\n===============\n\n.. pull-quote::\n Because programmers are lazy...\n\nModelish is a quick attempt to save a few keystrokes. Many data modeling tools\nare a GUI nightmare, with dropdowns and lots of buttons. But sometimes,\nespecially when you are sketching something out, writing out full Django models\ncan be a bit tedious.\n\nModelish will parse a file with a simplified model declaration in a flavor of\nYAML and generate Python code for model definition.\n\nNormally I would say source code generation is a \"Bad Idea\", but really even\nin Python, Django models are a mostly declarative syntax\n\n\nQuickstart\n----------\n\nInstall django-predicate:\n\n.. code-block:: console\n\n pip install django-modelish\n\nYou can then start banging out models like this\n\n.. code-block:: yaml\n\n Poll:\n doc: This is the poll model\n question:\n type: char\n max_length: 200\n pub_date:\n type: datetime\n args: date published\n\n Choice:\n poll:\n type: fk\n args: [Poll]\n choice_text-char:\n max_length: 200\n votes:\n type: int\n\nYou then just use the CLI tool:\n\n.. code-block:: console\n\n modelish path-to-file.yml\n\nThis will generate code like this:\n\n.. code-block:: python\n\n class Poll(models.Model):\n \"\"\"This is the poll model\"\"\"\n\n pub_date = models.DateTimeField(\n 'date published')\n question = models.CharField(\n max_length=200,\n blank=True)\n\n class Choice(models.Model):\n choice_text = models.CharField(\n max_length=200,\n blank=True)\n poll = models.ForeignKey(\n 'Poll')\n votes = models.IntegerField()\n\nSyntax\n------\n\nThe syntax is pretty simple::\n\n :\n [doc: docstring]\n [-type-alias]:\n [type: type-alias],\n [args: arglist],\n kwarg: value\n\nThe field type is represented by a shortened 'type' alias so 'char' becomes\n'models.CharField' etc (see grammarish below).\n\nThe type can be specified one of two ways, either following the field name with\na hyphen, or explicitly declared as a ``type`` in the field definition.\n\nPositional args to the model specified as an explicit list in square brackets,\nor as a comma delimited string.\n\nThe remaining block of the field definition consists of kwarg/value pairs.\n\nWorking with grammarish\n-----------------------\n\nModelish works with a grammar composed of type aliases and defaults. The standard\ntypes are:\n\n.. code-block:: yaml\n\n auto: AutoField\n bigint: BigIntegerField\n bool: BooleanField\n char: CharField\n date: DateField\n datetime: DateTimeField\n decimal: DecimalField\n email: EmailField\n file: FileField\n float: FloatField\n image: ImageField\n int: IntegerField\n ip: IPAddressField\n gip: GenericIPAddressField\n nbool: NullBooleanField\n pint: PositiveIntegerField\n psint: PositiveSmallIntegerField\n slug: SlugField\n sint: SmallIntegerField\n text: TextField\n time: TimeField\n url: URLField\n fk: ForeignKey\n m2m: ManyToManyField\n timestamp: DateTimeField\n\nFor each type - a set of default kwargs is defined in the grammar as\n``defaults``:\n\n.. code-block:: yaml\n\n defaults:\n bool:\n default: true\n char:\n max_length: 100\n blank: true\n nbool:\n null: true\n timestamp:\n auto-now: true\n\nThis default grammar can be replace, or enhanced by passing your own yaml files\nto the command. Use ``--grammar`` to replace the default grammer, and use\n``--extra-grammar`` to merge in and update the default grammer with your own\nadditions or changes.\n\nThat's it - this isn't meant to be any sort of full featured model builder or\ndata modeler, it is just a simple DSLish bootstrap tool to give you\na models.py starting point with a little less typing.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/ptone/django-modelish", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "django-modelish", "package_url": "https://pypi.org/project/django-modelish/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-modelish/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/ptone/django-modelish" }, "release_url": "https://pypi.org/project/django-modelish/0.1/", "requires_dist": null, "requires_python": null, "summary": "A simple markup and processor to make initial models.py less tedious", "version": "0.1" }, "last_serial": 748687, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "220c1f4d5e917d09778debeeda85cd45", "sha256": "a7ffd8bdef4d0ac078901fce2d7c88ca10bb7a92e5d2af9f056c67b2b2838990" }, "downloads": -1, "filename": "django-modelish-0.1.tar.gz", "has_sig": false, "md5_digest": "220c1f4d5e917d09778debeeda85cd45", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9361, "upload_time": "2012-08-18T15:57:06", "url": "https://files.pythonhosted.org/packages/95/ac/d6246b9cf6da0f26abcab24eceacc2b00c4144a790d674f9976ef758a7ed/django-modelish-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "220c1f4d5e917d09778debeeda85cd45", "sha256": "a7ffd8bdef4d0ac078901fce2d7c88ca10bb7a92e5d2af9f056c67b2b2838990" }, "downloads": -1, "filename": "django-modelish-0.1.tar.gz", "has_sig": false, "md5_digest": "220c1f4d5e917d09778debeeda85cd45", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9361, "upload_time": "2012-08-18T15:57:06", "url": "https://files.pythonhosted.org/packages/95/ac/d6246b9cf6da0f26abcab24eceacc2b00c4144a790d674f9976ef758a7ed/django-modelish-0.1.tar.gz" } ] }