      # Deal with forward many-to-many relationships.
      for field in [field for field in opts.many_to_many if field.serialize]:
          forward_relations[field.name] = RelationInfo(
              model_field=field,
              related_model=get_related_model(field),
              to_many=True,
              # manytomany do not have to_fields
              to_field=None,
              has_through_model=(
                  not get_remote_field(field).through._meta.auto_created
 
</s> remove                 not get_remote_field(field).through._meta.auto_created
 </s> add                 not field.remote_field.through._meta.auto_created </s> remove             related_model=get_related_model(field),
 </s> add             related_model=field.remote_field.model, </s> remove     for field in [field for field in opts.fields if field.serialize and get_remote_field(field)]:
 </s> add     for field in [field for field in opts.fields if field.serialize and field.remote_field]: </s> remove                 (getattr(get_remote_field(relation.field), 'through', None) is not None) and
                not get_remote_field(relation.field).through._meta.auto_created
 </s> add                 (getattr(relation.field.remote_field, 'through', None) is not None) and
                not relation.field.remote_field.through._meta.auto_created </s> remove     for field in [field for field in opts.fields if field.serialize and not get_remote_field(field)]:
 </s> add     for field in [field for field in opts.fields if field.serialize and not field.remote_field]:
            related_model=field.remote_field.model,
      # Deal with forward many-to-many relationships.
      for field in [field for field in opts.many_to_many if field.serialize]:
          forward_relations[field.name] = RelationInfo(
              model_field=field,
            related_model=field.remote_field.model,
              to_many=True,
              # manytomany do not have to_fields
              to_field=None,
              has_through_model=(
                  not get_remote_field(field).through._meta.auto_created
keep keep keep keep replace keep keep keep keep keep
 Remove Django 1.8 & 1.9 compatibility code (#5481)

* Identify code that needs to be pulled out of/removed from compat.py

* Extract modern code from get_names_and_managers in compat.py and remove compat code

* Extract modern code from is_authenticated() in compat.py and remove.

* Extract modern code from is_anonymous() in compat.py and remove

* Extract modern code from get_related_model() from compat.py and remove

* Extract modern code from value_from_object() in compat.py and remove

* Update postgres compat

JSONField now always available.

* Remove DecimalValidator compat

* Remove get_remote_field compat

* Remove template_render compat

Plus isort.

* Remove set_many compat

* Remove include compat 
rest_framework/utils/model_meta.py