Ejemplo n.º 1
0
def delete(id):
    entity = obj_or_404(Entity.by_id(id))
    authz.require(authz.list_write(entity.list_id))
    selectors = entity.terms
    entity.delete()
    db.session.commit()
    refresh_selectors.delay(list(selectors))
    return jsonify({"status": "ok"})
Ejemplo n.º 2
0
def delete(id):
    authz.require(authz.list_write(id))
    lst = obj_or_404(List.by_id(id))
    selectors = lst.terms
    lst.delete()
    db.session.commit()
    refresh_selectors.delay(list(selectors))
    return jsonify({'status': 'ok'})
Ejemplo n.º 3
0
def create():
    data = EntityForm().deserialize(request_data())
    authz.require(data["list"])
    authz.require(authz.list_write(data["list"].id))
    entity = Entity.create(data, current_user)
    db.session.commit()
    refresh_selectors.delay(list(entity.terms))
    return view(entity.id)
Ejemplo n.º 4
0
def delete(id):
    entity = obj_or_404(Entity.by_id(id))
    authz.require(authz.list_write(entity.list_id))
    selectors = entity.terms
    entity.delete()
    db.session.commit()
    refresh_selectors.delay(list(selectors))
    return jsonify({'status': 'ok'})
Ejemplo n.º 5
0
def create():
    data = EntityForm().deserialize(request_data())
    authz.require(data['list'])
    authz.require(authz.list_write(data['list'].id))
    entity = Entity.create(data, current_user)
    db.session.commit()
    refresh_selectors.delay(list(entity.terms))
    return view(entity.id)
Ejemplo n.º 6
0
def update(id):
    entity = obj_or_404(Entity.by_id(id))
    authz.require(authz.list_write(entity.list_id))
    data = EntityForm().deserialize(request_data())
    authz.require(data["list"])
    authz.require(authz.list_write(data["list"].id))
    old_selectors = entity.terms
    entity.update(data)
    db.session.commit()
    selectors = old_selectors.symmetric_difference(entity.terms)
    refresh_selectors.delay(list(selectors))
    return view(entity.id)
Ejemplo n.º 7
0
def update(id):
    entity = obj_or_404(Entity.by_id(id))
    authz.require(authz.list_write(entity.list_id))
    data = EntityForm().deserialize(request_data())
    authz.require(data['list'])
    authz.require(authz.list_write(data['list'].id))
    old_selectors = entity.terms
    entity.update(data)
    db.session.commit()
    selectors = old_selectors.symmetric_difference(entity.terms)
    refresh_selectors.delay(list(selectors))
    return view(entity.id)