tomchristie/django-rest-framework — pull request #1217 by benpbenp (2013-11-08 13:35:22+00:00)
Title: Fix object creation with reverse M2M when related_name unspecified

It seems that field.related_query_name() does not return the related_name
for reverse M2M relations when related_name is not explicitly set in the M2M field
definition.

So, change to use obj.get_accessor_name(), where obj is an instance of
RelatedObject, as are returned by a model's
_meta.get_all_related_many_to_many_objects(), or as in the tuples returned by
_meta.get_all_m2m_objects_with_model().