exclude specific fields in flask-admin's create/edit forms
Asked Answered
N

1

7

I have some fields in my models which I specifically want to exclude from my ModelView.

Reference https://flask-admin.readthedocs.org/en/latest/api/mod_model/, I attempted to exclude those specific fields using form_exclude_columns, e.g.

class UserView(ModelView):

    form_exclude_columns = ('created', 'modified')

But that doesn't seem to work.

How can I easily exclude these two fields in my create and edit ModelView pages?

Nickolai answered 24/4, 2014 at 4:34 Comment(0)
I
19

The attribute should be named form_excluded_columns. You forgot the 'd'.

class UserView(ModelView):

    form_excluded_columns = ('created', 'modified')
Impeller answered 24/4, 2014 at 5:20 Comment(1)
LOL!! I must be blind... THANKS!Nickolai

© 2022 - 2024 — McMap. All rights reserved.