在 Turbogears 中进行 CRUD

发布于 2024-07-06 05:50:04 字数 136 浏览 8 评论 0原文

是否有任何好的软件包或方法可以在 Turbogears 框架中执行广泛的 CRUD(创建-检索-更新-删除)接口。 FastDataGrid 小部件就像一个黑盒子,没有什么用处,而 CRUDTemplate 看起来比我自己的更麻烦。 有想法吗? 建议?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

归途 2024-07-13 05:50:05

所以你需要增删改查。 实现这一目标的最佳方法是使用一个工具来消除所有蹩脚的代码。 该工具名为 tgext.admin。 但是您可以在多个级别上使用它。

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.
月牙弯弯 2024-07-13 05:50:05

虽然 CRUDTemplate 看起来有点复杂,但我想说你可以使用大约您选择的任何 ORM。 这仅取决于您需要自动化的程度(这通常意味着提前定义模型/模式)。 如果您使用 SQLAlchemy 或 SQLObject 组合在一起,您可能会学到更多知识并获得更好的控制,这两种方法都可以很好地与 TurboGears 配合使用。

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.

甩你一脸翔 2024-07-13 05:50:05

经过更多的挖掘和修改后,事实证明将 Cakewalk 界面放入应用程序中并不是非常困难。 如果不做很多工作的话,这并不漂亮,但它马上就能发挥作用。

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.

來不及說愛妳 2024-07-13 05:50:04

你真的应该看看 sprox ( http://sprox.org/ )。

它建立在 RESTController 之上,非常简单,文档齐全(imo),从您的数据库“神奇地”生成表单和验证,并让您只需编写最少的代码。 我真的很喜欢和它一起工作。

希望对您有帮助:)

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 :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文