API
Admin
- class flask_exts.admin.admin.Admin(app=None)
Collection of the admin views. Also manages menu structure.
- add_view(view, is_menu=True, category=None)
Add a view to the collection.
- Parameters:
view – View to add.
- get_url(endpoint, **kwargs)
Generate URL for the endpoint.
- Parameters:
endpoint – Flask endpoint name
kwargs – Arguments for url_for
- init_app(app)
Constructor.
- Parameters:
app – Flask application object
name – Application name. Will be displayed in the main menu and as a page title. Defaults to “Admin”
url – Base URL
endpoint – Base endpoint name for index view. If you use multiple instances of the Admin class with a single Flask application, you have to set a unique endpoint name for each instance.
- render(template, **kwargs)
Render template
- Parameters:
template – Template path to render
kwargs – Template arguments
- render_string(source, **kwargs)
Render source string as template
- Parameters:
source – Source string to render as template
kwargs – Template arguments
view
- class flask_exts.admin.view.View(name=None, endpoint=None, url=None, template_folder=None, static_folder=None, static_url_path=None, **kwargs)
- allow(*args, **kwargs)
Override this method to add permission checks.
It does not make any assumptions about the authentication system used in your application, so it is up to you to implement it.
By default, it will allow access for everyone.
- create_blueprint()
Create Flask blueprint.
- form_base_class
Base form class. Will be used by form scaffolding function when creating model form. Useful if you want to have custom constructor or override some fields.
alias of
FlaskForm
- get_url(endpoint, **kwargs)
Generate URL for the endpoint. If you want to customize URL generation logic (persist some query string argument, for example), this is right place to do it.
- Parameters:
endpoint – Flask endpoint name
kwargs – Arguments for url_for
- is_accessible()
Override this method to add permission checks.
It does not make any assumptions about the authentication system used in your application, so it is up to you to implement it.
By default, it will allow access for everyone.
- render(template, **kwargs)
Render template
- Parameters:
template – Template path to render
kwargs – Template arguments
- render_string(source, **kwargs)
Render source string as template
- Parameters:
source – Source string to render as template
kwargs – Template arguments