Hi, On Wed, Apr 7, 2010 at 9:35 PM, Jim N <jim.nach...@gmail.com> wrote: > I want to get Questions that a given User has not asked yet. That > is, Questions where there is no Asking record for a given User. I > have the User's id.
Well, you can use the exclude() method. In a ManyToMany, the "user" field is like a User with the additional properties defined in the "through" model, so I think you can just do: Question.objects.exclude(user__id=my_user__id) Just see the examples the documentation provides: http://www.djangoproject.com/documentation/models/many_to_many/ > Models look like: > > class Question(models.Model): > text = models.TextField() > question_type = models.ForeignKey('QuestionType') > user = models.ManyToManyField(User, through='Asking', null=True) > > class Asking(models.Model): > user = models.ForeignKey(User) > question = models.ForeignKey(Question) > is_primary_asker = models.BooleanField() > > User is the built-in django.contrib.auth.models User. > > Thanks! Maybe this is simple and I just am not seeing it. > > -Jim > > -- > 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. > > -- 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.