def disable_for_loaddata(signal_handler):
    @wraps(signal_handler)
    def wrapper(*args, **kwargs):
        for fr in inspect.stack():
            if inspect.getmodulename(fr[1]) == 'loaddata':
                return
        signal_handler(*args, **kwargs)
    return wrapper
See: https://code.djangoproject.com/ticket/8399
dataset/ETHPy150Open Tivix/django-common/django_common/decorators.py/disable_for_loaddata