'endpoint for checking/unchecking any boolean in a sqla model'

@api
@has_access_api
@expose(u'/checkbox/<model_view>/<id_>/<attr>/<value>', methods=[u'GET'])
def checkbox(self, model_view, id_, attr, value):

    modelview_to_model = {u'TableColumnInlineView': ConnectorRegistry.sources[u'table'].column_class}
    model = modelview_to_model[model_view]
    obj = db.session.query(model).filter_by(id=id_).first()
    if obj:
        setattr(obj, attr, (value == u'true'))
        db.session.commit()
    return json_success(u'OK')
