django-nonrel on Google App Engine - Implications of using ListField for ManyToMany

こ雲淡風輕ζ 提交于 2019-12-07 14:26:45

问题


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


回答1:


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"



来源:https://stackoverflow.com/questions/3877246/django-nonrel-on-google-app-engine-implications-of-using-listfield-for-manytom

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!