Ejemplo n.º 1
0
def create():
    family = Family()
    form = resource.save_request_params(family)

    if request.prefers_json:
        return (resource.render_json(family, status=201) if not form.errors
                else resource.render_json_errors(form.errors))

    return resource.render_html('new', status=201, family=family, form=form)
Ejemplo n.º 2
0
def index_family():
    families = Family.query.all()
    data = Family.jsonify(families, many=True)
    return utils.json_response(data)
Ejemplo n.º 3
0
def test_serializer(session, family):
    session.add(family)
    session.commit()
    family_json = family.jsonify()
    assert Family.jsonify(family) == family_json
    assert 'str' in family_json
Ejemplo n.º 4
0
def index_family():
    families = Family.query.all()
    data = Family.jsonify(families, many=True)
    return utils.json_response(data)
Ejemplo n.º 5
0
def new():
    family = Family()
    return resource.render_html(family=family, form=form_factory(family))
Ejemplo n.º 6
0
def test_serializer(session, family):
    session.add(family)
    session.commit()
    family_json = family.jsonify()
    assert Family.jsonify(family) == family_json
    assert 'str' in family_json
Ejemplo n.º 7
0
def family():
    from bauble.models import Family
    return Family(family=faker.first_name())