Code

Scaffolding

Please refer to ScaffoldScript? for previous information needed to understand this.

This script tries to do a few more, than this one I'm referring to. You should be interested in creating a form for every model on your app, and configure your urls file to have a default url mapping.

You have two scripts attached, the first one is called scaffold.py, it could be used alone to generate a default form for a model (-g form) or a default manipulator (-g manipulator).

The other is the main one, it's called meta_scaffold.py (The name is not very original, and if someone finds a better name, please feel free to change it ;). This script creates a template for each of your models. For instance, if you have defined a Blog, with Articles and Comments, after executing this script you will have an article_form.html, comment_form.html and a _urls.py with generic create/update/delete links for both articles and comments.

Download both files and put them next to your manage.py project file. They also have some info about theirselves, read them.


Note: This script currently has an error with M2M mappings... it refers to the variable 'newdata' rather than 'new_data'... not sure how to edit an existing file, so I'll just put this here.

Note: This script uses oldforms (not newforms)

Last modified 7 years ago Last modified on 06/30/07 05:58:10

Attachments (2)

Download all attachments as: .zip