Commit 5c5c62bb authored by Petrus J.v.Rensburg's avatar Petrus J.v.Rensburg

Adding your own views: Overriding the builtin views.

parent c6718591
......@@ -79,5 +79,24 @@ will look like
:target: ../_images/quickstart_3.png
Overriding specific model views
------------------
\ No newline at end of file
Overriding the builtin views
------------------------------------
If you want most of the builtin ModelView functionality, but you want to have your own view
in place of the default `create`, `edit`, or `list` view.
Then you can override the view in question as follows::
from flask_admin.contrib.sqla import ModelView
# Flask and Flask-SQLAlchemy initialization here
class UserView(ModelView):
@expose('/new/', methods=('GET', 'POST'))
def create_view(self):
"""
Custom create view.
"""
return self.render('create_user.html')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment