Khakis7
Khakis7

Reputation: 433

Flask_Admin not including some columns in create / edit but are included in the list

Basically what the title says: Flask-Admin is not including some columns in create / edit but are included in the list.

Flask-Admin is just not including 2 of the columns in the create or edit fields, but is including them in the list. Any idea why this might be happening? The two columns not included are flag_type and filters

filters = Column(JSONSchema(FeatureFlagsFiltersSchema),
                     doc="This field should contain filters for the feature flag applicability")

flag_type = Column(UnicodeTextEnum(FeatureFlagType), index=True,
                       doc="Specifies whether the feature flag is FE or BE related")

There are many other columns that are showing up fine such as name, ect.

I've tried doing something like below

form_create = ['code', 'label', 'doc', 'blanket_on_off_null', 'warn_after', 'ticket_id', 'usage_info', 'flag_type']

to force those columns to show up but they don't seem to be working. Thanks for the help! I can post more code if needed

Upvotes: 2

Views: 411

Answers (1)

stasiekz
stasiekz

Reputation: 1863

Probably due to the complexity of these fields, flask-admin can't figure out what kind of form widget it is supposed to render for them. You can try adding them in form_extra_fields with proper field types e.g.:

from wtforms.fields import TextAreaField

class TestModelView(ModelView):
    form_extra_fields = {
        'filters': TextAreaField('filters')
    }

Upvotes: 1

Related Questions