Beispiel #1
0
def create_tag(label):
    new_tag = Tag(
        label=label
    )

    db.session.add(new_tag)
    db.session.commit()
    return new_tag.serialize()
Beispiel #2
0
def create_tag():
    body = json.loads(request.data)
    title = body.get("title")
    if title is None:
        return failure_response("Invalid field!")
    new_tag = Tag(title=title)
    db.session.add(new_tag)
    db.session.commit()
    return success_response(new_tag.serialize(), 201)
def create_tag(body):
    tag = Tag(description=body.get("description"))
    db.session.add(tag)
    db.session.commit()
    return tag.serialize()