def make_view(title, endpoint, *args, **kwargs):
"""A shortcut to make a :class:`NaviItem` linking to a standard
Flask view. Equal to the following statement:
.. code-block:: python
NaviItem(
title=title,
url=lambda: url_for(endpoint, *args, **kwargs),
identity=endpoint
)
:param title: The title of new :class:`NaviItem`
:param endpoint: The endpoint of target view.
:type endpoint: :class:`str`
:param args: The unnamed arguments to :func:`flask.url_for` when
generating the `url`.
:param kwargs: The named arguments to :func:`flask.url_for` when
generating the `url`.
"""
return NaviItem(title, lambda: url_for(endpoint, *args, **kwargs),
endpoint)
评论列表
文章目录