0

I'm using wtforms-sqlalchemy extension to query on database and show the result to the user with a nice drop-down list inside a Flask driven web application.

The problem is I tried to get the content and show them on front-end side, But it does not matter how I want to get them it shows constantly below error message:

ValueError: too many values to unpack

code for form I haved used: http://paste.ubuntu.com/p/94QKgWdNT9/

My model: http://paste.ubuntu.com/p/JrRbX263pd/

Client side code: http://paste.ubuntu.com/p/Q3rfgNpbdN/

Bahram Aghaei
  • 40
  • 1
  • 6
  • Thanks, but that does solve my problem. I think there is something wrong with the query. It's not about dictionary stuff. – Bahram Aghaei Jul 30 '18 at 10:26
  • Try using SelectField.. `buyer = SelectField(coerce=int, choices=[(int(person.id), person.username) for person in PersonModel.query.all()])` – DarkSuniuM Jul 30 '18 at 10:54
  • Thanks there is a bug in that module (I think), but at the moment, if you use `wtforms.ext.sqlalchemy.fields` that works completely right. Actually I want to know what's wrong with that. – Bahram Aghaei Jul 31 '18 at 06:54

0 Answers0