  class MaxLengthValidator(CustomValidatorMessage, validators.MaxLengthValidator):
      pass
  
  
  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
  
  
  def authenticate(request=None, **credentials):
      from django.contrib.auth import authenticate
      if django.VERSION < (1, 11):
          return authenticate(**credentials)
      else:
 
</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 from rest_framework.compat import set_rollback
 </s> add 
  class MaxLengthValidator(CustomValidatorMessage, validators.MaxLengthValidator):
      pass
  
  

















  def authenticate(request=None, **credentials):
      from django.contrib.auth import authenticate
      if django.VERSION < (1, 11):
          return authenticate(**credentials)
      else:
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace 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