Skip to main content

Genrate CRUD interface in TurboGears

Project description

tgcrud is a ‘no magic’ crud (create, read, update, delete) interface generator, the generated codes are fully customizable. tgcrud heavily use form widgets and show you many TG 1.0 features in it’s controllers/templates.

tgcrud could generate sqlobject/sqlalchemy based crud interface with kid template. It could be plugged into any projects even if you don’t use kid template.

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.

Screencast

Yes, there’s a ‘Make a Book Site with TurboGears’ screencast with tgcrud.

If you are an experienced TG developer, you could watch the third one directly.

If you are new to TG, you may want to watch all of them in sequence.

With tgcrud you could easily generate a Rails scaffold style CRUD interface. The difference is all code in tgcrud is implicit, which leads a 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.

Please refer to http://docs.turbogears.org/1.0/CRUDTemplate for detail

ChangeLog for 1.0

  • generated code set parameter literaly in save method

  • ‘import session’ now only shows on SA template

  • sqlalchemy db auto detection

  • add –dry-run element

Project details


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.0Beta.zip (23.2 kB view details)

Uploaded Source

Built Distributions

tgcrud-1.0Beta-py2.5.egg (18.7 kB view details)

Uploaded Source

tgcrud-1.0Beta-py2.4.egg (18.8 kB view details)

Uploaded Source

File details

Details for the file tgcrud-1.0Beta.zip.

File metadata

  • Download URL: tgcrud-1.0Beta.zip
  • Upload date:
  • Size: 23.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for tgcrud-1.0Beta.zip
Algorithm Hash digest
SHA256 07fe6b17c1ce00232c6b7b11ff971234ae165fe12b680e5149cfabe8d051f2ca
MD5 1f199ebd75ae39a1f0d98d94b17096cb
BLAKE2b-256 6cfb16cc26ebc32f18e8345a28b19eb8a27ebd8be4b9d4269c32fd132b4355d1

See more details on using hashes here.

File details

Details for the file tgcrud-1.0Beta-py2.5.egg.

File metadata

  • Download URL: tgcrud-1.0Beta-py2.5.egg
  • Upload date:
  • Size: 18.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for tgcrud-1.0Beta-py2.5.egg
Algorithm Hash digest
SHA256 93de9a1131f7480bf660dde2e4fcdc9823f7c254da391417c7cd5cab16be9859
MD5 fae370af5b0461cf7286d28f206a341b
BLAKE2b-256 9c69ae47fadb2688ca317f888859c4c6bc0610321f34c73baa15c855a40bd463

See more details on using hashes here.

File details

Details for the file tgcrud-1.0Beta-py2.4.egg.

File metadata

  • Download URL: tgcrud-1.0Beta-py2.4.egg
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for tgcrud-1.0Beta-py2.4.egg
Algorithm Hash digest
SHA256 ad9600dd9573dd9163219fe074153f41afcc0ce410e10cf4d0d799eb39430ce0
MD5 b37add72d8702a1a46be7b63d5597f2f
BLAKE2b-256 115b4cbb3479b837d112355fba8c7b73542b5b44f6ccb57b7b204e7fae2e269c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page