1

I have an app based on flask-appbuilder 3.3.3. I'd like to do insert some records in tableB after adding a record in tableA.

I have overridden the post_add() method :

class UploadFilesModelView(ModelView):
    datamodel = SQLAInterface(UploadFile)

    def post_add(self, item):
       # do something
       raise exception("error")

Although an exception was raised, and it is shown in the console, an error message showed on the web page. It shows the "list" page instead.

How to show an exception message of post_add() on the page?

Ismoil Shokirov
  • 2,213
  • 2
  • 16
  • 32
Lin Forest
  • 107
  • 8

1 Answers1

0

It's impossible
you should override your own _add() method
https://flask-appbuilder.readthedocs.io/en/latest/_modules/flask_appbuilder/baseviews.html# enter image description here

Dương Thái
  • 25
  • 2
  • 9
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – MD. RAKIB HASAN Oct 19 '22 at 12:43