  from __future__ import unicode_literals
  
  from django.conf import settings
  from django.core.exceptions import PermissionDenied
  from django.db import models
  from django.http import Http404
  from django.http.response import HttpResponseBase
  from django.utils import six
  from django.utils.cache import cc_delim_re, patch_vary_headers
  from django.utils.encoding import smart_text
 
</s> remove from django.db import connection, models, transaction
 </s> add from django.db import models </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 connection, models, transaction
  from __future__ import unicode_literals
  
  from django.conf import settings
  from django.core.exceptions import PermissionDenied
from django.db import connection, models, transaction
  from django.http import Http404
  from django.http.response import HttpResponseBase
  from django.utils import six
  from django.utils.cache import cc_delim_re, patch_vary_headers
  from django.utils.encoding import smart_text
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