question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TaggableManager.set() API does not match RelatedManager.set()

See original GitHub issue

TaggableManager has set(*tags, clear=False) while RelatedManager expects the tag objects as a list ie set(tags, bulk=True, clear=False, through_defaults=None). Would it be possible to support setting tags as a list/tuple too? The different interface makes it harder to plug that TaggableManager into other django libraries.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
coredumperrorcommented, Sep 8, 2021

I agree 100% that this is a bug. I’ve now been burned by this difference in APIs between TaggableManager.set() and RelatedManager.set(), as I’m trying to use the same code to set various different types of tags on objects, and only one of those types is handled by django-taggit. So the API being different screws me.

0reactions
pablolmedoradocommented, Nov 7, 2021

I’ve been facing this issue trying to use a “tags” field together with the library “django-import-export”. It’s been impossible.

Read more comments on GitHub >

github_iconTop Results From Across the Web

django-taggit
tags = TaggableManager(). Note: If you want django-taggit to be CASE-INSENSITIVE when looking up existing tags, you'll have to set.
Read more >
Using Django-taggit with django-rest-framework, i'm not ...
meet the same question. But I just want to save the tag list directly by TaggableManager (without TagListSerializer and TagsListAPIView).
Read more >
Changelog — django-taggit 1.3.0 documentation
Backwards incompatible: TaggableManager.set now takes a list of tags (instead of varargs) so that its API matches Django's RelatedManager.set . Example:.
Read more >
'_TaggableManager' object is not iterable-django
Exception Value: '_TaggableManager' object is not iterable ... with CONTROL-C. > /Users/gr/Desktop/PycharmProjects/godo/api/serializers.py(112)create() ...
Read more >
prefetch_related - new feature suggestion
There is also a fairly nasty use of .extra() which is needed so that ... that did require changing your code (no API...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found