Genrate CRUD interface in TurboGears
Project description
tgcrud is an TurboGears command extension, which could generate a sqlobject/sqlalchemy backend editor/crud (create, read, update, delete) interface based on your Model with kid template. It could be plugged into any projects even if you don’t use kid template.
The generated codes are fully customizable. tgcrud heavily use form widgets and show you many TG 1.0 features in it’s controllers/templates.
Please refer to http://docs.turbogears.org/1.0/CRUDTemplate for detail
The command follow the TurboGears quickstart template style, you could easily add identity, form validation, paginate in your crud interface.
If you are a TG beginer, tgcrud help you create a general admin skeleton based on your model.
If you are an experienced TG developer, you could get it in minutes since it just done the basic procedure that every time you write a management interface of your model.
Install
The ‘tgcrud’ command extension is available in Python CheeseShop and TurboGears svn.
You can use setuptools to install tgcrud with following command:
$ easy_install tgcrud
or download the source code and install tgcrud manually.
Usage
Define your model in model.py
Once you’ve defined your model, you could use “tg-admin crud” command to generate the crud pack. The syntax is:
$ tg-admin crud [model class name] [package name]e.x if the model name is BookMark, and the package name we want is BookMarkController, the command is:
$ tg-admin crud BookMark BookMarkControllerThen the ‘admin’ package is generated.
You just need take several minutes to customize the formfield to have a proper crud interface.
..note:: you could estimate the result by passing “–dry-run” to the command, such as:
$ tg-admin crud BookMark BookMarkController --dry-run With this argument the command will not effect your physical directories.Import the package to your controllers.py with a line:
from BookMarkController import BookMarkController
and add a branch on your Root():
foo = BookMarkController()Customize the form filed in admin/controllers.py
Open the http://localhost:8080/foo to use the customizable interface.
Please check http://docs.turbogears.org/1.0/CRUDTemplate for detail instructions.
Screencast
Yes, there’s a ‘Make a Book Site with TurboGears’ screencast with tgcrud.
If you are an experienced TG developer, you could skip to the third.
If you are new to TG, you may want to watch all of them to get familiar with TurboGears.
Quickstart TurboGears project, 6.5MB
Design model with toolbox utilities, 7.7MB
tgcrud, the TG’s scaffold, 5.2 MB
With tgcrud you could easily generate a Rails scaffold style CRUD interface. The difference is all code in tgcrud is implicit, which leads to more easy customization.
ChangeLog
- 1.0
- Fully SQLAlchemy support with
SQLObject/SQLAlchemy auto detection
Able to specify the primary id
Minor template updates
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file tgcrud-1.0.zip
.
File metadata
- Download URL: tgcrud-1.0.zip
- Upload date:
- Size: 22.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 329821abb341b70ec0e8f1b33afe1b6cc543369799ac6528a6faa7e93c826b76 |
|
MD5 | 17f0068d2fddda068790cec2ad60cafc |
|
BLAKE2b-256 | dcd9f2b8416881f5fe94adbccf00a59147fc01cb4c105891664fadbba794f375 |
File details
Details for the file tgcrud-1.0-py2.5.egg
.
File metadata
- Download URL: tgcrud-1.0-py2.5.egg
- Upload date:
- Size: 20.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9b0788295de5b9ebac6b248c304d864c8413b66fa2757b8ea2201eac767b944 |
|
MD5 | 945f3808d88f51a4e20b20cd750ac58d |
|
BLAKE2b-256 | 0a944e6bc274a778da7389a340270764734f67f785fa96a8f3965b4a231ea4c4 |
File details
Details for the file tgcrud-1.0-py2.4.egg
.
File metadata
- Download URL: tgcrud-1.0-py2.4.egg
- Upload date:
- Size: 23.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f4a28dd7aecfa51f3b8667d6fe7e8b90660027fd38b96f6880db891c3d99704 |
|
MD5 | 3b25d0ca9b694f652f297f9543384b72 |
|
BLAKE2b-256 | 14b2eeff3631bbb684b034cb4b8550a88ce5252bd81347bec127de75c985c5d8 |