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

Possible to change TaggableManager to inherit from ManyToManyField?

Open john2x opened this issue 9 years ago • 2 comments

I ran into an issue yesterday when using the combo of django-rest-framework + django-taggit + django-rest-swagger.

The gist is that:

  1. django-rest-swagger attempts to get serializer field metadata via django-rest-framework to render its documentation UI
  2. django-rest-framework uses Django's (about to be deprecated) get_all_related_objects and get_all_related_many_to_many_objects methods to get the related fields
  3. django-taggit's TaggableManager is incorrectly listed as a non-ManyToMany relationship due to it not inheriting directly from ManyToManyField, which the 2 methods above check for, as opposed to checking the many_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?

john2x avatar Dec 24 '15 03:12 john2x

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).

zbyte64 avatar May 26 '17 21:05 zbyte64

Changing TaggableManager sounds tricky, your description sounds like the other libs are the problem here. That being said... might be easier to move TaggableManager

rtpg avatar Apr 14 '21 06:04 rtpg