Wednesday, June 22, 2011

manytomany query problem

I have two models with a manytomany through relation (A and B). B has
a self referential manytomany relation (a userprofile model). How
could I filter objects of model B per each relationship with model A?
So lets say 3 arbitrary model A objects have 20 model B object
relations each. I want to filter the relations so when I return the
filtered version of model A is outputted, each object of type model A
returns only object Bs (the userprofiles) that are connected through
the self referential manytomany relationship to the userprofile (the
object B, sorry if I use them interchangeably but they are the same
thing) that is currently sending in the request. I figure out which
userprofile is sending the request with a unique identifier sent by
the user in the request (basically their primary key). Is this type
of filtering possible.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment