Hi list,
In my use case I have
groups that can include other groups (many to many)
groups can also include users (many to many)
users can 'have feelings' to other users (many to many)
What I want to achieve is :
for a given group, recursively find its sub users
for each of those users, I need the list of the users they ('like' | 'love' | 'hate' ... filter on this criteria)
we discussed the recursive point here :
http://www.mail-archive.com/sqlal...@googlegroups.com/msg24742.htmlso I manage to have a query that when executed returns a list of all sub users (of class User)
searched group is the starting point (Group object)
content_q = searched_group.get_all_users()of course, I can iterate on the result of this query, and then create a dict of list (or whatever)
all_users = set(content_q.all()) result = {} for user in all_users: result['user.id']=[] for other in user.my_feelings(feeling='love'): result['user.id'].append((other.id, other.name))Still as all those tables join, I have a feeling this could be accomplished in a single query
maybe not ?
thanks for any idea
NiL