I have a situation where I want a true or false to whether an object
is in a manytomany.

For instance, I have my users, and have created (separate to the
standard django groups) a groups table called GroupsOfUser with a
relationships defined as:

group_members = models.ManyToManyField(User, verbose_name="group
members", related_name="groupofumembers")

I know that I can do something like this:

instance = get_object_or_404(GroupsOfUser, id=form["groupid"])
auth_user = request.user

ismember = auth_user.groupofumembers.filter(id = instance.id)

And this would bring back ismember either populated with a
GroupsOfUser object, but all I want is a true or false to whether they
are in this group already. Is there an easy way of doing this?
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to