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

1

3

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

Outport answered 6/10, 2010 at 22:4 Comment(0)
H
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"

Hindenburg answered 6/10, 2010 at 23:34 Comment(2)
Thanks Mathias. That's the kind of answer I was looking for/hoping for. The number of relationships will be around 20. Basically I want to have a set of routes and then link buses to those routes. So if I were to build a model for that relationship, I guess it would be a model containing a bus and a route in each row?Outport
Yes, it would just be 2 ForeignKeyFields. Sounds like the separate model fits your use-case perfectly.Hindenburg

© 2022 - 2024 — McMap. All rights reserved.