django-taggit
django-taggit copied to clipboard
Possible to change TaggableManager to inherit from ManyToManyField?
I ran into an issue yesterday when using the combo of django-rest-framework + django-taggit + django-rest-swagger.
The gist is that:
- django-rest-swagger attempts to get serializer field metadata via django-rest-framework to render its documentation UI
- django-rest-framework uses Django's (about to be deprecated)
get_all_related_objects
andget_all_related_many_to_many_objects
methods to get the related fields - django-taggit's
TaggableManager
is incorrectly listed as a non-ManyToMany relationship due to it not inheriting directly fromManyToManyField
, which the 2 methods above check for, as opposed to checking themany_to_many
property of being True.
I've proposed a possible workaround for django-rest-framework to not use the deprecated methods and instead to check directly for the many_to_many
property, but I was wondering if there's a chance to make TaggableManager inherit from ManyToManyField to avoid potential similar problems?
I believe this is also impacting django-select2
. Allot of these external integrations assume a proper many2many field and data is getting munged in the handling between (from widget to field and back).
Changing TaggableManager
sounds tricky, your description sounds like the other libs are the problem here. That being said... might be easier to move TaggableManager