from __future__ import absolute_import, unicode_literals

from django.apps import apps as django_apps

from .signals import connect

__version__ = '0.0.1'
default_app_config = 'diffs.apps.DiffLogConfig'

klasses_to_connect = []


def register(klass):
    """
    Decorator function that registers a class to record diffs.

    @register
    class ExampleModel(models.Model):
        ...
    """
    from .models import DiffLogEntryManager
    from dirtyfields import DirtyFieldsMixin
    # Hack to add dirtyfieldsmixin automatically
    if DirtyFieldsMixin not in klass.__bases__:
        klass.__bases__ = (DirtyFieldsMixin,) + klass.__bases__

    klass.add_to_class('diffs', DiffLogEntryManager())

    if not django_apps.ready:
        klasses_to_connect.append(klass)
    else:
        connect(klass)

    return klass


from __future__ import absolute_import, unicode_literals

from .signals import connect

__version__ = '0.0.1'
default_app_config = 'diffs.apps.DiffLogConfig'

klasses_to_connect = []


def register(klass):
    """
    Decorator function that registers a class to record diffs.

    @register
    class ExampleModel(models.Model):
        ...
    """
    from django.apps import apps as django_apps
    from dirtyfields import DirtyFieldsMixin

    from .models import DiffLogEntryManager
    # Hack to add dirtyfieldsmixin automatically
    if DirtyFieldsMixin not in klass.__bases__:
        klass.__bases__ = (DirtyFieldsMixin,) + klass.__bases__

    klass.add_to_class('diffs', DiffLogEntryManager())

    if not django_apps.ready:
        klasses_to_connect.append(klass)
    else:
        connect(klass)

    return klass


Reorganize imports to be later
Reorganize imports to be later

  from __future__ import absolute_import, unicode_literals
- 
- from django.apps import apps as django_apps
  
  from .signals import connect
  
  __version__ = '0.0.1'
  default_app_config = 'diffs.apps.DiffLogConfig'
  
  klasses_to_connect = []
  
  
  def register(klass):
      """
      Decorator function that registers a class to record diffs.
  
      @register
      class ExampleModel(models.Model):
          ...
      """
+     from django.apps import apps as django_apps
+     from dirtyfields import DirtyFieldsMixin
+ 
      from .models import DiffLogEntryManager
-     from dirtyfields import DirtyFieldsMixin
      # Hack to add dirtyfieldsmixin automatically
      if DirtyFieldsMixin not in klass.__bases__:
          klass.__bases__ = (DirtyFieldsMixin,) + klass.__bases__
  
      klass.add_to_class('diffs', DiffLogEntryManager())
  
      if not django_apps.ready:
          klasses_to_connect.append(klass)
      else:
          connect(klass)
  
      return klass
  
  
Reorganize imports to be later
## Code Before:
from __future__ import absolute_import, unicode_literals

from django.apps import apps as django_apps

from .signals import connect

__version__ = '0.0.1'
default_app_config = 'diffs.apps.DiffLogConfig'

klasses_to_connect = []


def register(klass):
    """
    Decorator function that registers a class to record diffs.

    @register
    class ExampleModel(models.Model):
        ...
    """
    from .models import DiffLogEntryManager
    from dirtyfields import DirtyFieldsMixin
    # Hack to add dirtyfieldsmixin automatically
    if DirtyFieldsMixin not in klass.__bases__:
        klass.__bases__ = (DirtyFieldsMixin,) + klass.__bases__

    klass.add_to_class('diffs', DiffLogEntryManager())

    if not django_apps.ready:
        klasses_to_connect.append(klass)
    else:
        connect(klass)

    return klass


## Instruction:
Reorganize imports to be later
## Code After:
from __future__ import absolute_import, unicode_literals

from .signals import connect

__version__ = '0.0.1'
default_app_config = 'diffs.apps.DiffLogConfig'

klasses_to_connect = []


def register(klass):
    """
    Decorator function that registers a class to record diffs.

    @register
    class ExampleModel(models.Model):
        ...
    """
    from django.apps import apps as django_apps
    from dirtyfields import DirtyFieldsMixin

    from .models import DiffLogEntryManager
    # Hack to add dirtyfieldsmixin automatically
    if DirtyFieldsMixin not in klass.__bases__:
        klass.__bases__ = (DirtyFieldsMixin,) + klass.__bases__

    klass.add_to_class('diffs', DiffLogEntryManager())

    if not django_apps.ready:
        klasses_to_connect.append(klass)
    else:
        connect(klass)

    return klass

