[1.6.x] Fixed #23604 -- Allowed related m2m fields to be references in the admin.

Thanks Simon Charette for review.

Backport of a24cf21722 from master