Flask-AppBuilder icon indicating copy to clipboard operation
Flask-AppBuilder copied to clipboard

renders decorator for mapping custom Model properties

Open gnud opened this issue 10 years ago • 2 comments

Using the renders decorator on custom non-model fields, I'm experiencing None as the label of the field. http://flask-appbuilder.readthedocs.org/en/latest/api.html#module-flask.ext.appbuilder.models.decorators My app is set like this example project: https://github.com/dpgaspar/Flask-AppBuilder/blob/844883115c716292118a2680c559ac3f9291e8a2/examples/quickhowto2/app/views.py

However, when in the view I set either: show_fieldsets, or show_columns, the custom field has label None None label result

Solution: when list_columns is set like this:

list_columns = ['extra_col', 'extra_col2']

Both custom fields (model and non-model fields) have labels: With label result

My view class is of type: ModelView and my model is of type Model + AuditMixin.

gnud avatar Oct 29 '15 11:10 gnud

Thank you once more. I've not dived into the code yet, but this is probably because automatic labels are only contructed based on list_columns.

You can use your solution, or set the labels yourself using: label_columns dictionary

dpgaspar avatar Oct 29 '15 15:10 dpgaspar

Ok, I'll keep the solution for now.

gnud avatar Oct 29 '15 15:10 gnud