I\'ve got a pretty basic Flask app:
from flask import Flask, render_template
from flask_wtf import FlaskForm
from wtforms_sqlalchemy.fields import QuerySelec
Based on the patch that pjcunningham linked to, since wtforms hasn't released that update yet, I went ahead and created my own monkeypatch:
import wtforms_sqlalchemy.fields as f
def get_pk_from_identity(obj):
cls, key = f.identity_key(instance=obj)[:2]
return ':'.join(f.text_type(x) for x in key)
f.get_pk_from_identity = get_pk_from_identity
Plopping that in my codebase is enough to work for now until they cut a release that works with the newest version of SQLAlchemy.