def test_multiple_pk():
    # Test multiple primary keys - mix int and string together
    app, db, admin = setup()

    class Model(db.Model):
        id = db.Column(db.Integer, primary_key=True)
        id2 = db.Column(db.String(20), primary_key=True)
        test = db.Column(db.String)

    db.create_all()

    view = CustomModelView(Model, db.session, form_columns=['id', 'id2', 'test'])
    admin.add_view(view)

    client = app.test_client()

    rv = client.get('/admin/model/')
    eq_(rv.status_code, 200)

    rv = client.post('/admin/model/new/',
                     data=dict(id=1, id2='two', test='test3'))
    eq_(rv.status_code, 302)

    rv = client.get('/admin/model/')
    eq_(rv.status_code, 200)
    data = rv.data.decode('utf-8')
    ok_('test3' in data)

    rv = client.get('/admin/model/edit/?id=1,two')
    eq_(rv.status_code, 200)
    data = rv.data.decode('utf-8')
    ok_(data in 'test3')

    # Correct order is mandatory -> fail here
    rv = client.get('/admin/model/edit/?id=two,1')
    eq_(rv.status_code, 302)
dataset/ETHPy150Open flask-admin/flask-admin/flask_admin/tests/sqla/test_multi_pk.py/test_multiple_pk/swapped operands of `in`