コード例 #1
0
ファイル: project_api.py プロジェクト: scooterman/middleman
def set_project_models(hash_id):
    project = project_controller.get_project(current_user,
                                             current_app.extensions['hasher'].decode(hash_id)[0])

    for model in request.json['models']:
        project_controller.create_model(project, model['name'], model['attributes'] if 'attributes' in model else [])

    return 'ok', 200
コード例 #2
0
def test_model_creation(app, project_f):
    # we commit so we get an id for the project
    db.session.commit()
    model = project_controller.create_model(app.extensions['hasher'].encode(project_f.id), 'Products', [])

    assert model
    assert model.project == project_f

    return model