ToUIBlueprint#
- class toui.structure.ToUIBlueprint(*args, **kwargs)[source]#
Bases:
BlueprintA class that inherits flask.Blueprint.
The difference between this class and flask.Blueprint is that you can add Page objects to this class. To learn how to use blueprints, check flask’s documentation https://flask.palletsprojects.com/.
Examples
Creating a blueprint:
>>> from toui import ToUIBlueprint >>> blueprint = ToUIBlueprint("Blueprint", __name__)
Adding a Page to a blueprint:
>>> from toui import Page >>> page = Page(html_str="<h1>This page is part of a blueprint</h1>", url="/") >>> blueprint.add_pages(page)
Creating a Website and adding the blueprint to it:
>>> from toui import Website >>> app = Website(__name__) >>> app.register_toui_blueprint(blueprint)
See also
- Parameters:
args – flask.Blueprint arguments.
kwargs – flask.Blueprint keyword arguments.
Methods#
Adds pages to the blueprint. |
|
Registers a ToUIBlueprint object. |