dlamotte / django-tagging

Automatically exported from code.google.com/p/django-tagging
Other
0 stars 0 forks source link

usage_for_queryset bug #256

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I will illustrate the issue by an example: 
>>> Tag.objects.usage_for_queryset(Snippet.objects.all())
[<Tag: property>, <Tag: python>]

>>> Tag.objects.usage_for_queryset(Snippet.objects.all()[1:2])
[<Tag: property>, <Tag: python>]

>>> Tag.objects.usage_for_queryset(Snippet.objects.all()[2:3])
[<Tag: property>, <Tag: python>]

This is the first issue. The query set returned by inner function on second 
line doesn't contain any tag, how would it be possible? The function apparently 
just returns every tag found in the model, which is not intended. 

Second issue is this. 

>>> Snippet.objects.all()[0].tags
u'property, python'

#this will return the snippet above
>>> TaggedItem.objects.get_by_model(Snippet, 'python')
[<Snippet: Method Overloading in Python>]

#look for all tags this queryset contained. 
>>> Tag.objects.usage_for_queryset(TaggedItem.objects.get_by_model(Snippet, 
'python'))
[<Tag: python>]

As pointed out at the first line, above query should return [<Tag: property>, 
<Tag: python>]. But only [<Tag: python>] is returned. 

Original issue reported on code.google.com by wakan...@gmail.com on 20 Jan 2011 at 8:53