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."
# )
评论列表
文章目录