@receiver(m2m_changed, weak=False)<EOL>def m2m_callback(sender, instance, action, reverse, model, pk_set, using, **kwargs):
if validate_instance(instance) and settings.AUTOMATED_LOGGING['<STR_LIT>']:<EOL><INDENT>if action in ["<STR_LIT>", '<STR_LIT>']:<EOL><INDENT>modification = [model.objects.get(pk=x) for x in pk_set]<EOL>if '<STR_LIT>' in instance.__dict__.keys() and instance.al_chl:<EOL><INDENT>changelog = instance.al_chl<EOL><DEDENT>else:<EOL><INDENT>changelog = ModelChangelog()<EOL>changelog.information = ModelObject()<EOL>changelog.information.value = repr(instance)<EOL>changelog.information.type = ContentType.objects.get_for_model(instance)<EOL>changelog.information.save()<EOL>changelog.save()<EOL><DEDENT>for f in modification:<EOL><INDENT>obj = ModelObject()<EOL>obj.value = repr(f)<EOL>try:<EOL><INDENT>obj.type = ContentType.objects.get_for_model(f)<EOL><DEDENT>except Exception:<EOL><INDENT>logger = logging.getLogger(__name__)<EOL>logger.debug('<STR_LIT>')<EOL><DEDENT>obj.save()<EOL>if action == '<STR_LIT>':<EOL><INDENT>changelog.inserted.add(obj)<EOL><DEDENT>else:<EOL><INDENT>changelog.removed.add(obj)<EOL><DEDENT><DEDENT>changelog.save()<EOL>instance.al_chl = changelog<EOL>if '<STR_LIT>' in instance.__dict__.keys():<EOL><INDENT>target = instance.al_evt<EOL><DEDENT>else:<EOL><INDENT>target = Model()<EOL>target.user = get_current_user()<EOL>target.action = <NUM_LIT:2> if action == '<STR_LIT>' else <NUM_LIT:2><EOL>target.save()<EOL>ct = ContentType.objects.get_for_model(instance).app_label<EOL>target.application = Application.objects.get_or_create(name=ct)[<NUM_LIT:0>]<EOL>target.information = ModelObject()<EOL>target.information.value = repr(instance)<EOL>target.information.type = ContentType.objects.get_for_model(instance)<EOL>target.information.save()<EOL>instance.al_evt = target<EOL><DEDENT>target.modification = changelog<EOL>target.save()<EOL><DEDENT><DEDENT>
Many 2 Many relationship signall receivver.

Detect Many 2 Many relationship changes and append these to existing model or create if needed.
These get not recorded from the pre_save or post_save method and must therefor be received from
another method. This method to be precise.