  from django.db import models
  from django.utils import six
  
  FieldInfo = namedtuple('FieldResult', [
      'pk',  # Model field instance
      'fields',  # Dict of field name -> model field instance
      'forward_relations',  # Dict of field name -> RelationInfo
 
</s> remove     for relation in opts.get_all_related_objects():
 </s> add     for relation in get_all_related_objects(opts): </s> remove     for relation in opts.get_all_related_many_to_many_objects():
 </s> add     for relation in get_all_related_many_to_many_objects(opts):
from rest_framework.compat import (
    get_all_related_many_to_many_objects, get_all_related_objects
)

  from django.db import models
  from django.utils import six
  
from rest_framework.compat import (
    get_all_related_many_to_many_objects, get_all_related_objects
)

  FieldInfo = namedtuple('FieldResult', [
      'pk',  # Model field instance
      'fields',  # Dict of field name -> model field instance
      'forward_relations',  # Dict of field name -> RelationInfo
keep keep add keep keep keep keep
 Use related_objects api for Django 1.9+ 
rest_framework/utils/model_meta.py