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.
Features
----------------------
No Magic
* The generated codes are normal TG source.
* no extra magic encapsulation, thus you don't need to rewrite the
interface when you need extra flexibility (not the same as Rails'
scaffold)
* Separate Form definition from Model (not the same as Django admin)
* Use standard TurboGears syntax and code organization.
* It's a good crud implementation reference by TG.
TurboGears
* Provide the command line tool
* tgcrud kid interface works for you no matter whatever template
engine you currently choose for your project.
* You could customize the model relationship by widgets (document
shows how to customize 1-to-1, 1-to-many, many-to-many relationship with widgets.
Besides that, you could do it with HTML form in your way)
* Use widgets form heavily. you'd hardly need to modify the HTML. You
could add complex form validation via widgets, too.
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.
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
http://files.turbogears.org/video/openbook1.swf
- Design model with toolbox utilities, 7.7MB
http://files.turbogears.org/video/openbook2.swf
- tgcrud, the TG's scaffold, 5.2 MB
http://files.turbogears.org/video/openbook3.swf
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.
Usage
----------
1. Define your model in model.py
2. After 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,
the package name is BookMarkController, the command is::
$ tg-admin crud BookMark BookMarkController
Then 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.
3. Import the package to your controllers.py with a line:
from BookMarkController import BookMarkController
and add a branch on your Root()::
foo = BookMarkController()
4. Customize the form filed in admin/controllers.py
5. Open the http://localhost:8080/foo to use the customizable interface.
ChangeLog for 1.0 Beta 2
-------------------------
* remove db auto detection for flexibility
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.
Features
----------------------
No Magic
* The generated codes are normal TG source.
* no extra magic encapsulation, thus you don't need to rewrite the
interface when you need extra flexibility (not the same as Rails'
scaffold)
* Separate Form definition from Model (not the same as Django admin)
* Use standard TurboGears syntax and code organization.
* It's a good crud implementation reference by TG.
TurboGears
* Provide the command line tool
* tgcrud kid interface works for you no matter whatever template
engine you currently choose for your project.
* You could customize the model relationship by widgets (document
shows how to customize 1-to-1, 1-to-many, many-to-many relationship with widgets.
Besides that, you could do it with HTML form in your way)
* Use widgets form heavily. you'd hardly need to modify the HTML. You
could add complex form validation via widgets, too.
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.
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
http://files.turbogears.org/video/openbook1.swf
- Design model with toolbox utilities, 7.7MB
http://files.turbogears.org/video/openbook2.swf
- tgcrud, the TG's scaffold, 5.2 MB
http://files.turbogears.org/video/openbook3.swf
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.
Usage
----------
1. Define your model in model.py
2. After 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,
the package name is BookMarkController, the command is::
$ tg-admin crud BookMark BookMarkController
Then 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.
3. Import the package to your controllers.py with a line:
from BookMarkController import BookMarkController
and add a branch on your Root()::
foo = BookMarkController()
4. Customize the form filed in admin/controllers.py
5. Open the http://localhost:8080/foo to use the customizable interface.
ChangeLog for 1.0 Beta 2
-------------------------
* remove db auto detection for flexibility
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
tgcrud-1.0Beta2.zip
(23.2 kB
view details)
Built Distributions
tgcrud-1.0Beta2-py2.5.egg
(18.6 kB
view details)
tgcrud-1.0Beta2-py2.4.egg
(18.6 kB
view details)
File details
Details for the file tgcrud-1.0Beta2.zip
.
File metadata
- Download URL: tgcrud-1.0Beta2.zip
- Upload date:
- Size: 23.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 40671248e2830dfec148573fd2adb9284839387cc0e8125de1748f37b243288f |
|
MD5 | b4957b55ce3a0f4110706e54ae4de711 |
|
BLAKE2b-256 | 8fad432706ff9130a2c1b3620e2de628b6a88f87a14162700374fa5f0958ded3 |
File details
Details for the file tgcrud-1.0Beta2-py2.5.egg
.
File metadata
- Download URL: tgcrud-1.0Beta2-py2.5.egg
- Upload date:
- Size: 18.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24e307cd08ef17ee1e10d22bef84e0cf1e14bf43b9316f6d2fc7d89892486d36 |
|
MD5 | 9136dcd86378645e63230a1ec54e9c91 |
|
BLAKE2b-256 | 170d0004a5ea9edc1cd3b196cff261f8e05beb9ce454d2ffabc469779e755c46 |
File details
Details for the file tgcrud-1.0Beta2-py2.4.egg
.
File metadata
- Download URL: tgcrud-1.0Beta2-py2.4.egg
- Upload date:
- Size: 18.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3efb9fd73d525a31ff3f67ab55de9bd625eb63ffe7cd74fd780f46ca4e4656dd |
|
MD5 | 0f74f38b76adca63aa785fa29b14c5b7 |
|
BLAKE2b-256 | 7d058b79371e58c86fa2ee0a713f62a70ddf7b444773147d9ac97ecd2d3bd549 |