Flask-AppBuilder
Flask-AppBuilder copied to clipboard
Relation columns are shown which should be hidden
Environment
Flask-Appbuilder version: 4.1.3
Describe the expected results
I extended the example "quickhowto" by excluding the field "contact_group" from search.
class ContactModelView(ModelView): datamodel = SQLAInterface(Contact) ... search_exclude_columns = ["contact_group"]
I expected this result:
Describe the actual results
I extended the example "quickhowto" by excluding the field "contact_group" from search.
class ContactModelView(ModelView): datamodel = SQLAInterface(Contact) ... search_exclude_columns = ["contact_group"]
I got this:
Analysis:
I think the pull request #1862 causes this problem.
I think issue #1867 is also related to this problem.
@ThomasP0815,
search_exclude_columns
does not relate with the edit form. Why were you expecting for the field to be excluded?
@dpgaspar
get_filter_args changes self._filters thats why exclude_cols does not include the relation anymore!
Sorry, I may be miss understanding, this what you've reported. So you've excluded contact_group
from the search and it's rendered on the edit form, this is expected

I'll double check
Navigation path:
- menu "Contacts" -> "List Groups"
- show "Friends"
- tab "List Contact"
- edit "Abbey Szkarlat Faraday Etti"
- "contact group" field should be hidden
why should it be hidden? we are excluding it from search not from the edit form
I know, but excluding this field from search triggers this issue!
counter question, why was this field hidden in the past (using version 3.4.5)?
Tested on 3.4.5 an got the same behaviour.
For example using the examples quickhowto, create a new ModelView
:
class ContactModelView2(ModelView):
datamodel = SQLAInterface(Contact)
list_columns = ["name", "personal_celphone", "birthday", "contact_group.name"]
base_order = ("name", "asc")
edit_columns = ["name", "personal_celphone", "birthday", "contact_group"]
search_exclude_columns = ["contact_group"]
...
appbuilder.add_view(
ContactModelView2, "List Contacts2", icon="fa-envelope", category="Contacts"
)
On the UI, the search is excluded:
The edit form still shows contact_group
:
Yes this result is alwright, but you didn't follow the navigation path!
- menu "Contacts" -> "List Groups"
- show "Friends"
- tab "List Contact"
- edit "Abbey Szkarlat Faraday Etti"
- "contact group" field should be hidden
oh! I see what you mean, it's on the related model views. sorry
It's a bug, needs to be fixed
@ThomasP0815 got a fix up: https://github.com/dpgaspar/Flask-AppBuilder/pull/1898
Thank you for the bug report, this is currently fixed on master. Will make a new release soon