Hi I need to make a query as follows Select all entries where categories=mycategory
In the db there are entries and categories as follows Category.objects.all() -->[ <Category: mycategory>,<Category: hiscategory>,<Category: theircategory>] MyEntry.objects.all() --> [ <MyEntry: [u'mycategory']> ,<MyEntry: [u'mycategory',u'hiscategory' ]>, <MyEntry: [u'theircategory']>] I tried like this mycategory=Category.objects.get(name='mycategory') MyEntry.objects.filter(categories=mycategory) But this returns entries where the categories field contains 'mycategory' and 'hiscategory' also. How do I mention to retrieve only 'mycategory'. I went through the Queryset docs ..but couldn't figure it out... Any help would be appreciated thanks jim p.s: My models are class MyEntry(models.Model): categories=models.ManyToManyField(Category) class Category(models.Model): name=models.CharField(unique=True,max_length=50) -- 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.