  from django.views.decorators.csrf import csrf_exempt
  from django.views.generic import View
  
  from rest_framework import exceptions, status
  from rest_framework.compat import set_rollback
  from rest_framework.request import Request
  from rest_framework.response import Response
  from rest_framework.schemas import AutoSchema
  from rest_framework.settings import api_settings
  from rest_framework.utils import formatting
 
</s> remove from django.db import connection, models, transaction
 </s> add from django.db import models </s> remove from django.db import models
 </s> add from django.db import connection, models, transaction </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.views.decorators.csrf import csrf_exempt
  from django.views.generic import View
  
  from rest_framework import exceptions, status

  from rest_framework.request import Request
  from rest_framework.response import Response
  from rest_framework.schemas import AutoSchema
  from rest_framework.settings import api_settings
  from rest_framework.utils import formatting
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/views.py