Hi,

I'm having a mental block this afternoon and am completely stuck on
filtering on a many-to-many relationship and was wondering if anyone
can.

I have two models....

class Model1(models.Model):
    name = models.CharField(max_length=200)
    duration = models.TimeField()

class Model2(models.Model):
    name = models.CharField(_("name"), max_length = 200)
    tasks = models.ManyToManyField(CalendarTasks)

I have post containing a list of selected tasks, e.g. task 1 and task
2. I want to filter on the second model to only return results if
model2 has both tasks assigned in the tasks field. If it only has one,
then I want it too return none.

I've tried using __in=[1,2] but that seems to be 1 or 2. Not 1 and 2.

Any help would be much appreciated.

Kind Regards

Wes




-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
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