

def test_column_editable_list():
    (app, db, admin) = setup()
    (Model1, Model2) = create_models(db)
    view = CustomModelView(Model1, db.session, column_editable_list=['test1', 'enum_field'])
    admin.add_view(view)
    fill_db(db, Model1, Model2)
    client = app.test_client()
    rv = client.get('/admin/model1/')
    data = rv.data.decode('utf-8')
    ok_(('data-role="x-editable"' in data))
    rv = client.post('/admin/model1/ajax/update/', data={
        'list_form_pk': '1',
        'test1': 'change-success-1',
    })
    data = rv.data.decode('utf-8')
    ok_(('Record was successfully saved.' == data))
    rv = client.get('/admin/model1/')
    data = rv.data.decode('utf-8')
    ok_(('change-success-1' in data))
    rv = client.post('/admin/model1/ajax/update/', data={
        'list_form_pk': '1',
        'enum_field': 'problematic-input',
    })
    eq_(rv.status_code, 500)
    rv = client.post('/admin/model1/ajax/update/', data={
        'list_form_pk': '1000',
        'test1': 'problematic-input',
    })
    data = rv.data.decode('utf-8')
    eq_(rv.status_code, 500)
    rv = client.post('/admin/model1/ajax/update/', data={
        'list_form_pk': '1',
        'test2': 'problematic-input',
    })
    data = rv.data.decode('utf-8')
    ok_(('problematic-input' not in data))
    view = CustomModelView(admin, db.session, column_editable_list=['model1'])
    admin.add_view(view)
    rv = client.post('/admin/model2/ajax/update/', data={
        'list_form_pk': '1',
        'model1': '3',
    })
    data = rv.data.decode('utf-8')
    ok_(('Record was successfully saved.' == data))
    rv = client.get('/admin/model2/')
    data = rv.data.decode('utf-8')
    ok_(('test1_val_3' in data))

dataset/ETHPy150Open flask-admin/flask-admin/flask_admin/tests/sqla/test_basic.py test_column_editable_list/VarMisuse@307/496 `Model2`->`admin`