pallets-eco / flask-admin

Simple and extensible administrative interface framework for Flask
https://flask-admin.readthedocs.io
BSD 3-Clause "New" or "Revised" License
5.78k stars 1.57k forks source link

form_choices with boolean value. Error return: Not a boolean value: 'True' #2111

Open animax1991 opened 3 years ago

animax1991 commented 3 years ago

I'm using form_choices of flask-admin. The buy_or_sell column is a boolean column. Here is my code:

column_choices  = {
        'buy_or_sell':[
            (True, "Buy"),
            (False, "Sell")
        ]
    }

And I got the error whenever I try to create or update the data. Error: sqlalchemy.exc.StatementError: (builtins.TypeError) Not a boolean value: 'True'

I think the 'True' value is a string, not a boolean, that trigger the error. Is there anyway to bypass this problem? Thank you!

hasansezertasan commented 1 year ago

I'm having the same issue, is there a solution for this?