views:

627

answers:

4

Are there any good packages or methods for doing extensive CRUD (create-retrieve-update-delete) interfaces in the Turbogears framework. The FastDataGrid widget is too much of a black box to be useful and CRUDTemplate looks like more trouble than rolling my own. Ideas? Suggestions?

A: 

While CRUDTemplate looks mildly complex, I'd say that you can implement CRUD/ABCD using just about any ORM that you choose. It just depends on how much of it you with to automate (which generally means defining models/schemas ahead of time). You may learn more and have better control if you put together your own using SQLAlchemy or SQLObject, woth of which work great with TurboGears.

Sean
I reallllllly hate code generators, what if you need to adjust something and then need to regenerate because your model changed?
Jorge Vargas
A: 

After doing some more digging and hacking it turns out to not be terribly hard to drop the Cakewalk interface into an application. It's not pretty without a lot of work, but it works right away.

Chris Vogt
Cakewalk? you probably mean Catwalk. In TG1 it's a bit broken. In TG2 it's awesome as it's sprox based. Although You should be using tgext.admin directly.
Jorge Vargas
+3  A: 

You should really take a look at sprox ( http://sprox.org/ ).

It builds on RESTController, is very straight forward, well documented (imo), generates forms and validation "magically" from your database and leaves you with a minimum of code to write. I really enjoy working with it.

Hope that helps you :)

Tom
sprox excels at creating CRUD.
Jorge Vargas
+1  A: 

So you need CRUD. The best way to accomplish this is with a tool that takes all the lame code away. This tool is called tgext.admin. However you can use it at several levels.

  • Catwalk2, a default config of tgext.admin that is aware of your quickstarted model.
  • AdminController, this will take all your models (or a list of them) and create CRUD for all of them.
  • CrudRestController, will take one object and create CRUD for it.
  • RestController, will take one object and give you only the REST API, that is no forms or data display.
  • plain Sprox, you will give it an object and and depending on the base class you use you will get the neww form or the edit for or the table view or the single record view.
Jorge Vargas