Example #1
0
def log_delete_entity(entity):
    """
    :param entity: Uma instância de core.models.Entity
    :type entity: core.models.Entity
    """
    log = Log(entity_key=entity.number, kind=Log.DELETE)
    log.description = 'Name: %s' % entity.name
    log.save()
Example #2
0
def log_update_entity(entity, old_values):
    """
    :type entity: core.models.Entity
    :type old_values: dict
    """
    log = Log(entity_key=entity.number, kind=Log.UPDATE)
    old_name = old_values['name'] if 'name' in old_values else ''
    log.description = 'Old name: %s\nNew name: %s' % (old_name, entity.name)
    log.save()