def update_log_object_create(sender, **kwargs): if sender!=Item or sender!=ItemTemplate or sender!=ItemGroup or sender!=Item or sender!=Person: return if 'created' in kwargs: if kwargs['created']: entry = Log(content_object=kwargs['instance'], action="object created: %s" % kwargs['instance'], description=__get_changelog(sender, kwargs['instance'],old_record=False)) entry.save()
def update_log_object_update(sender, **kwargs): if sender!=ItemTemplate or sender!=ItemTemplate or sender!=ItemGroup or sender!=Item or sender!=Person: return try: old_instance = sender.objects.get(pk=kwargs['instance'].id) except: return entry = Log(content_object=kwargs['instance'], action="object updated: %s" % kwargs['instance'], description=__get_changelog(sender, kwargs['instance'])) entry.save()