Possible bug with fetch_related?

12 views
Skip to first unread message

vi...@unessa.net

unread,
Apr 28, 2017, 7:18:50 AM4/28/17
to django-taggit
Hello djangonauts!

I have a following model with tags:


tags
= TaggableManager(through='knuckles.UUIDTaggedItem', blank=True)


where UUIDTaggedItem is:


class UUIDTaggedItem(GenericUUIDTaggedItemBase, TaggedItemBase):

   
class Meta:
        verbose_name
= "Tag"
        verbose_name_plural
= "Tags"



When I query for the tags I get following:


In [18]: e = LiveEvent.objects.get(slug='dj-tony-004')
In [19]: e.tags.all()

Out[19]: <QuerySet [<Tag: 90s>, <Tag: dj tony>, <Tag: house>, <Tag: radioshow>, <Tag: 00's>, <Tag: trance>, <Tag: 90's>, <Tag: eurodance>]>


In [20]: e = LiveEvent.objects.prefetch_related('tags').get(slug='dj-tony-004')
In [21]: e.tags.all()

Out[21]: <QuerySet []>




So when using prefetch_related, I always get empty tags. Not sure if I'm doing something wrong here or if this is a bug?

I'm using Django version 1.11 and django-taggit version 0.22.0
Reply all
Reply to author
Forward
0 new messages