Commit fe47ff72 authored by Serge S. Koval's avatar Serge S. Koval

Some more changes

parent 96f51f31
This example shows how to customize Flask-Admin layout and overall look and feel.
\ No newline at end of file
...@@ -41,8 +41,10 @@ class CustomView(ModelView): ...@@ -41,8 +41,10 @@ class CustomView(ModelView):
create_template = 'create.html' create_template = 'create.html'
edit_template = 'edit.html' edit_template = 'edit.html'
class UserAdmin(CustomView):
column_searchable_list = ('name',) column_searchable_list = ('name',)
column_filters = ('name',) column_filters = ('name', 'email')
# Flask views # Flask views
...@@ -52,11 +54,11 @@ def index(): ...@@ -52,11 +54,11 @@ def index():
if __name__ == '__main__': if __name__ == '__main__':
# Create admin # Create admin with custom base template
admin = admin.Admin(app, base_template='layout.html') admin = admin.Admin(app, base_template='layout.html')
# Add views # Add views
admin.add_view(CustomView(User, db.session)) admin.add_view(UserAdmin(User, db.session))
admin.add_view(CustomView(Page, db.session)) admin.add_view(CustomView(Page, db.session))
# Create DB # Create DB
......
__version__ = '1.0.4' __version__ = '1.0.5'
__author__ = 'Serge S. Koval' __author__ = 'Serge S. Koval'
__email__ = 'serge.koval+github@gmail.com' __email__ = 'serge.koval+github@gmail.com'
......
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