by modocache

Generate a Django model, views, URLconf, and templates using a single command.

131 Stars 35 Forks Last release: Not found 44 Commits 5 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

django-generate-scaffold build-status endorse

Generate a Django model, views, URLconf, and templates using a single command.


A screencast introducing

is available here.


Generating Models, Views, URL Patterns, and Templates

  • Install

    $ pip install django-generate-scaffold
  • Add

    to your
  • Run the

    management command:
    $ python generatescaffold --help
    ... displays usage
  • Create a model using the syntax in the help message:

    $ python generatescaffold blogs Post title:string body:text is_public:bool blog:foreignkey=Blog
    ... Generates a Post model, with title (CharField), body (TextField),
    ...     is_public (BooleanField), and blog (ForeignKey) fields.

Generating Views, etc. Based on Existing Models

  • Alternatively, you can generate views, urlpatterns, and templates for an existing model:

    $ python generatescaffold blogs --model Post
    ... Generates views, etc. for Post
  • Note that if the model specified with the

    option has a
    or a
    , date-based generic views will be generated based on that field. To specify a specific field to use, pass in the
    $ python generatescaffold blogs --model Post --timestamp-field ctime

Limitations When Using Existing Models

For best results, existing models should implement a

method which conforms to the urlpatterns used by
    def get_absolute_url(self):
        return ('__detail', (), {'pk':})

Not conforming to this model will lead to broken links and potentially other issues when rendering templates.


is currently in ALPHA.

Running Tests

In order to run the test suite, install your local version of

and start a Selenium server and issue the following commands:
    $ cd django-generate-scaffold
    $ python install --force
    $ cd test_project
    $ python test_app/tests/


for the exact steps necessary to run the test suite.

Autotesting via watchr

By installing the gems in the Gemfile, you can automatically run all non-Selenium based tests every time a file is modified:

    $ watchr autotest.rb

How to Contribute

  • Propose new features or report bugs by creating an issue on Github.
  • Add new features, tests, or fix stuff and issue a pull request.
  • Create a better, more eloquent screencast with less stammering.


If you experience any issues, please create an issue on Github.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.