Hey everyone, thanks for looking. I couldn't think of a good title for
this one. I have a question on queries on manytomany relations. Here
is an example:

class Item:
    genre = models.ForeignKey(Genre)

class Genre:
    name = models.CharField()

class Video:
    genre = models.ManyToManyField(Genre)



Heres the situation.. I want to do a get() on item and find any items
where the item.genre is equal to one of the video's genres. A video
can have many genres.

My first thought was Item.objects.get(genre=video.genre.all()), but
this only works when there is only one genre selected for the video.
Is there any way to do this without doing an iteration on the videos
selected genres and testing each case?

I feel like i've accomplished this before, but I may just be having an
off day. Thanks!

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

Reply via email to