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)
def index_family(): families = Family.query.all() data = Family.jsonify(families, many=True) return utils.json_response(data)
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
def new(): family = Family() return resource.render_html(family=family, form=form_factory(family))
def family(): from bauble.models import Family return Family(family=faker.first_name())