Hi, I have these two simple models defined (using today's trunk) class Tag(models.Model): name = models.CharField(max_length=100) related = models.ManyToManyField('self', symmetrical=False, through='TagCorrelation', blank=True)
class TagCorrelation(models.Model): from_tag = models.ForeignKey(Tag, related_name='related_source') to_tag = models.ForeignKey(Tag, related_name='related_target') common_posts = models.IntegerField(blank=True, null=True) You see, it is a slightly denormalized way to store relation between tags. Now, after reading the docs at http://docs.djangoproject.com/en/dev/topics/db/models/, following this esample: # Find all the members of the Beatles that joined after 1 Jan 1961 >>> Person.objects.filter( ... group__name='The Beatles', ... membership__date_joined__gt=date(1961,1,1)) [<Person: Ringo Starr] it seems that it should be possible to query the using attributes of the intermediate model. So I tried with: Tag.objects.filter(tagcorrelation__common_posts_gt=1) but tt does not work, gives this error: FieldError: Cannot resolve keyword 'tagcorrelation' into field. Choices are: id, name, post, related, related_source, related_target, source, tag Am i missing something? 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-users@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 -~----------~----~----~----~------~----~------~--~---