Justin Gardner
Justin Gardner

Reputation: 625

Flask App Builder Related Views

I am trying to create a One to Many solution with Flask App Builder. I want to be able to click on the show button for one of my items and have it show all the related items beneath it.

Ie Company goes to many files.

Is Flask App Builders Related Views the correct solution for this? If so, why am I getting this error:

   File "/home/justin/github_projects/RhynoRecon/RR/lib/python2.7/site-packages/flask_appbuilder/baseviews.py", line 739, in _get_related_view_widget
    log.error("Can't find relation on related view {0}".format(related_view.name))
AttributeError: 'FileView' object has no attribute 'name'

Upvotes: 1

Views: 1020

Answers (1)

Nachtkinder
Nachtkinder

Reputation: 11

I think you're missing a backref on your File model class. You likely already have the relationship between the files and the company defined in your File model as:

company = relationship('Company')

In order for the files to be found from the CompanyView you need to update it to:

company = relationship('Company', backref='files')

Hope this helps.

Upvotes: 1

Related Questions