Google App Engine 上的 django-nonrel - 对 ManyToMany 使用 ListField 的影响

发布于 2024-09-26 02:15:55 字数 361 浏览 1 评论 0原文

我正在开发 Google App Engine 应用程序,对此我还比较陌生。

我已经在 Django 中构建了一个应用程序,并拥有一个使用 ManyToMany 字段类型的模型。

我知道 django-nonrel 不支持 Django 的多对多字段类型。所以我正在考虑使用 ListField 代替。

问题:
- 使用 ListField 而不是 ManyToMany 有何含义?
- 我知道这意味着 Django 的 JOIN API 无法使用。但这对我的应用程序意味着什么? - 在多对多领域中搜索某些内容时,我会遇到问题吗?

抱歉,如果这些是编程 101 个问题。我是一名设计师,试图专注于开发。

谢谢

I am working on a Google App Engine application and I am relatively new at this.

I have built an app already in Django and have a model using a field type of ManyToMany.

I am aware that django-nonrel does not support many-to-many field types of Django. So I am considering using ListField instead.

Questions:
- What is the implication of using ListField instead of ManyToMany?
- I am aware that this means that Django's JOIN API cannot be used. But what does this mean for my app?
- Am I going to have problems when it comes to doing a search for something in a many-to-many field?

Apologies if these are programming 101 questions. I'm a designer trying to get my head around development.

Thanks

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

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

发布评论

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

评论(1

晨光如昨 2024-10-03 02:15:55

正如您可能知道的那样,您将更加手动地跨越关系。
Django 的帮助不如使用 ManyToMany 时那么多,但它不应该是一个大问题。

根据关系的复杂性,您可能需要考虑为此目的构建一个模型。

我从未在 GAE 上使用过这种方法,因为在我看来,只有当一个对象有很多关系(我想说超过 50 个)或者当你计划进行的查找将从中受益时,它才有效。也许是因为它们以相同的频率从关系的任一端开始,或者能够循环关系以显示它们或类似的东西会很好。

上次我在 GAE 上做一些事情时,我使用了 ListField(或当时已知的 ListProperty),因为大多数对象只有大约 20 个相关对象,并且查找很少会以其他方式进行。

总而言之,这没什么大不了的,而且我不记得与它一起工作/周围有任何痛苦。

希望这有帮助,尽管它相当“IMO”

Well as you probably know, you will be spanning the relationship more manually.
Django cannot help quite as much as when using ManyToMany, but it should not be that big a problem.

Depending on the complexity of the relationship, you might want to consider building a model just for this purpose.

I have never used that approach on GAE, since IMO its only valid when an object has alot relations (more than 50 I would say) or when the lookups you plan to do, will benefit from this. Maybe because they start at either end of the relationship with equal frequency or it would be nice to be able to loop over the relationships to display them or something along those lines.

Last time I made something on GAE I used the ListField (or ListProperty as it was known then) since most of the objects only had about 20 related objects and the lookups would rarely go the other way.

So all in all, its not a big deal and I don't remember it as any kind of a pain to work with/around.

Hope this was helpful despite it being rather "IMO"

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