def met(sender, instance, action, reverse, model, pk_set, **kwargs):
    if action == 'post_add':
        if instance.law:
            for law in instance.law.all():
                for category in law.categories.all():
                    instance.categories.add(category)
instance.save()
Prepopulating Django M2M field based on another M2M