django-tagulous icon indicating copy to clipboard operation
django-tagulous copied to clipboard

ValueError: Could not find manager CastTaggedUserManager in tagulous.models.tagged.

Open KhanMaytok opened this issue 7 years ago • 3 comments

I'm trying to set tag tree models and I get the error ValueError: Could not find manager CastTaggedUserManager in tagulous.models.tagged.

The TagTreeModel is:

class BusinessPhase(tagulous.models.TagTreeModel):
    class TagMeta:
        # Tag options
        force_lowercase = True

And the model is:

class User(AbstractUser):
    business_choices = tagulous.models.TagField(to=BusinessPhase)

KhanMaytok avatar Feb 21 '18 18:02 KhanMaytok

Just stumbled upon the same... do you remember what was the solution?

perepicornell avatar Mar 04 '21 14:03 perepicornell

I believe imports now need to be more specific, and the docs need updating in some places. Try from tagulous.models import TagField, TagTreeModel - and do please let me know if that worked!

radiac avatar Mar 04 '21 20:03 radiac

Thanks a lot! But it didn't work. What worked was extending also TaggedManager in my custom manager, from this:

class CCUserManager(UserManager):

to this:

from tagulous.models import TaggedManager
class CCUserManager(TaggedManager, UserManager):

I don't feel super good about it because I imagine that TaggedManager was not meant to be a mixin, if anyone knows if this solution is bad for some reason I'll be very happy to hear it :sweat_smile:

perepicornell avatar Mar 05 '21 08:03 perepicornell