With a custom through model for an M2M relationship, .add()
, .create()
and .remove()
are disabled.
At the moment, I attempt to use .add()
(or whatever) and catch and deal with AttributeError
for those custom M2M relationships.
Is there an 'official' way to identify a custom through model, using the Meta
API or otherwise? At this stage in my processing, I would rather treat all custom through relationships as generically as possible (rather than lots of if m2m_field.related.through == FooBar
statements)
(A solution was found for Django 1.8, but I'm starting a bounty for 2.2)
Looks as though
does the job.