Google App Engine上的django-nonrel - 使用ListField for ManyToMany的含义 [英] django-nonrel on Google App Engine - Implications of using ListField for ManyToMany

查看:144
本文介绍了Google App Engine上的django-nonrel - 使用ListField for ManyToMany的含义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Google App Engine应用程序,而我相对较新。

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

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

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

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

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

问题:

- 使用ListField而不是ManyToMany的含义是什么?

- 我知道这意味着Django的JOIN API无法使用。但这对我的应用程序意味着什么?
- 在多对多领域搜索某些东西时,我会遇到问题吗?

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?

如果这些是编程101的问题。我是一个设计师,试图让我的头脑在发展。

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

谢谢

推荐答案

你可能知道,你会更加手动地跨越关系。
Django不能像使用ManyToMany那么多,但是它不应该是那么大的问题。

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.

我从来没有使用这种方法对GAE,因为IMO它只有当一个对象有很多关系(超过50我会说),或者当你打算做的查询将从中受益。也许是因为他们以相同的频率在关系的两端开始,或者可以循环遍历关系以显示他们或沿着这些线路。

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.

上一次我在GAE上做了一些事情时,我使用了ListField(或者ListProperty,因为它是众所周知的),因为大多数对象只有大约20个相关对象,查找很少会以其他方式。

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.

希望这是有帮助的,尽管它是相当IMO

Hope this was helpful despite it being rather "IMO"

这篇关于Google App Engine上的django-nonrel - 使用ListField for ManyToMany的含义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆