Open SlimBeji opened 3 years ago
This can be resolved if you convert the status column to a proper enum field
class User(db.Model):
id = Column(db.Integer, primary_key=True)
name = Column(db.UnicodeText)
email = Column(db.UnicodeText, unique=True, nullable=False)
status = Column(db.Enum("trailing", "active"))
@caffeinatedMike Thank you for your answer but we don't really want to put such strong constraint on the DB side. Between downgrading to bootstrap3 or changing the model, we prefer bootstrap3.
Is there a possibility of fixing the bootstrap4 template ?
Try this:
def on_form_prefill(self, form, id):
form.status.choices = [("trialing", "trialing"), ("active", "active")]
I also encountered the same problem. The same code works fine in local testing, but not on the production server.
Hello,
I am trying to use flask-admin with bootstarp4 template mode.
I have a class user that contains a status field
In the flask admin panel, I want to restrict the values that can be set for the
user.status
to"trialing"
and"active"
for example.so I have defined the following view
The Edit view works as expected however trying to edit the field in the List view does not work as expected even though I specified
column_editable_list = ["status"]
. When checking the logs, I get a weird:after decoding:
Switching to bootstrap3 does fix the issue and I am able to use the predefined choices in both List and Edit view.