def notify_items(**kwargs):
    """
    Signal endpoint that actually sends knocks whenever an instance is created / saved
    """
    instance = kwargs.get('instance')
    created = kwargs.get('created', False)
    if hasattr(instance, 'send_knock') and active_knocks(instance):
        try:
            # This is a stupid generic interface for multilanguage models (hvad / parler)
            if hasattr(instance, 'get_available_languages'):
                langs = instance.get_available_languages()
            else:
                langs = [get_language()]
            for lang in langs:
                with override(lang):
                    instance.send_knock(created)
            return True
        except AttributeError:  # pragma: no cover
            pass
    return False
def notify_items ( ** kwargs ) : instance = kwargs . get ( 'instance' ) created = kwargs . get ( 'created' , False ) if hasattr ( instance , 'send_knock' ) and active_knocks ( instance ) : try : if hasattr ( instance , 'get_available_languages' ) : langs = instance . get_available_languages ( ) else : langs = [ get_language ( ) ] for lang in langs : with override ( lang ) : instance . send_knock ( created ) return True except AttributeError : pass return False
Signal endpoint that actually sends knocks whenever an instance is created / saved