flaskflask-wtformsflask-securityflask-appbuilder

Flask appbuilder how to replace registration form?


I want to be able to have users self-register but I want to be able to customize the registration form without having to change the default form inside the flask-app builder files.


Solution

  • Create your custom form then create a form view and inherit MyRegisterUserDBView which is the class you choose different templates and such or use the base RegisterUserDBView. The code example can be seen here: https://gist.github.com/RafaelCenzano/5b2b823634dbbf6b655983dbf1bf0776

    Last make sure you have your custom security manager class that inherits BaseSecurityManager and add it into your appbuilder object.

    appbuilder = AppBuilder(app, db.session, security_manager_class=MySecurityManager)