[EMAIL PROTECTED] wrote: > > def tags(request, url): > > # Don't need the last item in the list since it will > > # always be an empty string since Django will append > > # a slash character to the end of URLs by default. > > tags = url.split('/')[:-1] > > posts = Post.objects.filter(tags__name__in=tags) > > return render_to_response("blog/tags.html", {'posts': posts}) > > If I'm not mistaken, __in will return results that aren't tagged by all > tags. So using the original example: > > Post1: articles, python, django > Post2: articles, python > Post3: articles, music > > and tags has [articles, python, django], all 3 posts will be returned > since IN just OR's the values together, correct? That's why I came up > with that mess of a loop.
Yes, you are right. I was not thinking straight. Anyone know what the best method for performing this in SQL would be? Select all posts for each tag and use intersect? --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---