Hi all!
I have 2 models: Clip, Tag.
class Clip(models.Model):
          name = models.CharField(max_length=80)
          tags = models.ManyToManyField(Tag, through = 'TagsToClips')

class Tag(models.Model):
          tagName = models.CharField(max_length=80, unique=True)

class TagsToClips(models.Model)
          clip = models.ForeignKey(Clip)
          tag = models.ForeignKey(Tag)
          start_frame = models.IntegerField()
          end_frame = models.IntegerField()
          class meta:
                  unique_together = ("clip", "tag",
"start_frame","end_frame")

now, assume I have clip named "clip_1", and tag "adult_scene" with
tag.id = 1
if I tag the the same clip twice with the same tag but different
frames (clip has an adult scene from frame 1 to 10 and also from frame
50 to 70 )
now I wnat all clips with adult scenes - I filter:
clip_set = Clip.objects.filter(tags__id__exact = 1)

I get the clip "clip_1" twice! (clip_set.all() =
[<Clip:clip_1>,<Clip:clip_1>])
I tried to filter in different ways, but didn't succeed.
What am I doing wrong?
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