  from django.apps import apps
  from django.conf import settings
  from django.core import validators
  from django.core.exceptions import ImproperlyConfigured
  from django.db import connection, models, transaction
  from django.utils import six
  from django.views.generic import View
  
  try:
      from django.urls import (  # noqa
 
</s> remove from django.db import models
 </s> add from django.db import connection, models, transaction </s> remove from rest_framework.compat import set_rollback
 </s> add  </s> remove def set_rollback():
    if hasattr(transaction, 'set_rollback'):
        if connection.settings_dict.get('ATOMIC_REQUESTS', False):
            # If running in >=1.6 then mark a rollback as required,
            # and allow it to be handled by Django.
            if connection.in_atomic_block:
                transaction.set_rollback(True)
    elif transaction.is_managed():
        # Otherwise handle it explicitly if in managed mode.
        if transaction.is_dirty():
            transaction.rollback()
        transaction.leave_transaction_management()
    else:
        # transaction not managed
        pass


 </s> add 
from django.db import models
  from django.apps import apps
  from django.conf import settings
  from django.core import validators
  from django.core.exceptions import ImproperlyConfigured
from django.db import models
  from django.utils import six
  from django.views.generic import View
  
  try:
      from django.urls import (  # noqa
keep keep keep keep replace keep keep keep keep keep
 Remove set_rollback() from compat (#5591)

* Remove Django 1.6 transaction compat

* Move set_rollback from compat => views 
rest_framework/compat.py