signals.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:kfusiontables 作者: kula1922 项目源码 文件源码
def post_save_handler(sender, instance, **kwargs):
    """
    Called when any of models saved or updated.
    """
    logger.info(
        'Singal sync on post_save from django to google fusiontables'
        ' for model: %s and row id: %s',
        sender._meta.db_table,
        instance.id
    )

    try:
        kft = _get_kft_instance(sender=sender, raw=kwargs.get('raw'))[1]
        if not instance._ft_id:
            kft.insert_rows(sender=sender, row_id=instance.id)
        else:
            kft.update_rows(sender=sender, row_id=instance._ft_id)
    except SkipException as exc:
        logger.debug("Skip synchronization: %s", exc.args)
    # else:
    #     raise CannotCreateInstanceException(
    #         "Internal error: Cannot create kfusiontables instance."
    #     )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号