Flask / Quart themes
Flask / Quart tools for creating themes.
Install
> pip install flask-quart-themes
Setup
Flask
from flask import Flask, render_template
from flask_theming.setup_flask import setup_flask_themes
from flask_theming.decorators_flask import page_title, menu_entry
app = Flask(__name__)
setup_flask_themes(app, title_default="Plak")
@page_title("Users zone")
@menu_entry("users::home")
def index():
return render_template("user_home.html")
@page_title("Dashboard")
@menu_entry("dashboard", icon="fa fa-dashboard")
def dashboard():
return render_template("dashboard.html")
NOTE: This only works in Flask < 2.3!
Quart
from quart import Quart, render_template
from flask_theming.setup_quart import setup_quart_themes
from flask_theming.decorators_quart import page_title, menu_entry
app = Quart(__name__)
setup_quart_themes(app, title_default="Plak")
@page_title("Users zone")
@menu_entry("users::home")
async def user():
return await render_template("user_home.html")
@page_title("Dashboard")
@menu_entry("dashboard", icon="fa fa-dashboard")
async def dashboard():
return await render_template("dashboard.html")
Jinja utils
Title
<!DOCTYPE html>
<html lang="es">
<head>
<title>{{ theme_title }}</title>
</head>
Menu
<nav class="sidenav shadow-right sidenav-light">
<div class="nav accordion" id="accordionSidenav">
{% set dashboard = theme_menu.get_entry("dashboard") %}
<a class="nav-link" href="{{ url_for(dashboard.path) }}">
<!-- ########### -->
<!-- IT WILL PRINT: 'fa fa-dashboard' -->
<div class="nav-link-icon"><i class="{{ dashboard.icon }}"></i></div>
<!-- ########### -->
<!-- ########### -->
<!-- IT WILL PRINT: 'dashboard' -->
{{ dashboard.title }}
<!-- ########### -->
</a>
<!-- User zone menu -->
{% for menu in theme_menu.get_menu("users-zone") %}
<a class="nav-link collapsed" data-bs-toggle="collapse" data-bs-target="#collapseDashboards" aria-expanded="false" aria-controls="collapseDashboards">
<div class="nav-link-icon"><i data-feather="users"></i></div>
<!-- ########### -->
<!-- IT WILL PRINT: 'Users' -->
{{ menu.header }}
<!-- ########### -->
<div class="sidenav-collapse-arrow"><i class="fas fa-angle-down"></i></div>
</a>
<div class="collapse" id="collapseDashboards" data-bs-parent="#accordionSidenav">
<nav class="sidenav-menu-nested nav accordion" id="accordionSidenavPages">
<!-- ########### -->
<!-- IT WILL GET ALL 'Users' paths -->
{% for entry in menu.entries %}
<a class="nav-link" href="{{ url_for(entry.path) }}">{{ entry.title }}</a>
{% endfor %}
<!-- ########### -->
</nav>
</div>
{% endfor %}
</div>
</nav>
{{ menu() }}
Metadata
Release files for flask-quart-themes 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| flask-quart-themes-1.0.0.tar.gz | 9.5 kB | Without provenance | Details for flask-quart-themes-1.0.0.tar.gz |
Release files / flask-quart-themes-1.0.0.tar.gz
| Download URL | flask-quart-themes-1.0.0.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c077998bcb3d8784ce6ac9f6d619308608995105b2e3d400e550a85fd6efd478
|
|
BLAKE2b-256 checksum How to use checksums |
63955c71f864cb1fd3d18476343161d106ff8e744ed38a5fa835d63e0ad66cac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Security for flask-quart-themes 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.