def get_migration_data():
 try:
  from django.contrib.auth import get_user_model
 except ImportError:
  from django.contrib.auth.models import User
 else:
  User = get_user_model()
 user_orm_label = ('%s.%s' % (User._meta.app_label, User._meta.object_name))
 user_model_label = ('%s.%s' % (User._meta.app_label, User._meta.module_name))
 return (User, user_orm_label, user_model_label)

def get_migration_data ( ) : try : from django . contrib . auth import get_user_model except ImportError : from django . contrib . auth . models import User else : User = get_user_model ( ) user_orm_label = ( '%s.%s' % ( User . _meta . app_label , User . _meta . object_name ) ) user_model_label = ( '%s.%s' % ( User . _meta . app_label , User . _meta . module_name ) ) return ( User , user_orm_label , user_model_label )
support for django custom user models see this blog post for inspiration URL URL .