@receiver(activity_update)
def object_changed(sender, instance, **kwargs):

    if instance._bmfmeta.has_logging and len(instance._bmfmeta.observed_fields) > 0:
        changes = []
        for key in instance._bmfmeta.observed_fields:
            try:
                if instance._bmfmeta.changelog[key] != getattr(instance, key):
                    changes.append((key, instance._bmfmeta.changelog[key], getattr(instance, key)))
            except KeyError:
                pass

        if len(changes) > 0:
            history = Activity(
                user=instance.modified_by,
                parent_ct=ContentType.objects.get_for_model(sender),
                parent_id=instance.pk,
                action=ACTION_UPDATED,
                text=json.dumps(changes, cls=DjangoBMFEncoder),
            )
            history.save()
dataset/ETHPy150Open django-bmf/django-bmf/djangobmf/models/__init__.py/object_changed/original