Skip to main content

This module defines classes that can be rendered as "views" in a flask application.

The following example define a form to input some text as a component class (this additionally uses tailwindcss classes):

from flask_composed_views.components import BaseComponent, Form, FormTextInput, Span, PlainText, FormSubmit

class WordInputForm(BaseComponent):
    def __init__(self, id = None, classes = None, csrf_token: str | None = None):
        form = Form(id='word-input-form',
                    classes=classes,
                    csrf_token=csrf_token,
                    action='/',
                    children=[
                        FormTextInput(label=Span(classes="p-2 font-bold",
                                                 children=PlainText('Wort >', safe=True,)),
                                      name='word',
                                      id=id,
                                      classes="border-1 border-solid broder-gray-400",
                                      max_len=44),
                        FormSubmit(label=PlainText('Suchen'),
                                   classes=" ".join([
                                        "rounded-lg px-2 py-1 font-bold bg-yellow-200 hover:bg-yellow-300",
                                        "active:bg-yellow-200 active:border-2 active:border-yellow-200",
                                        "mx-4"
                                   ]))
                    ])
        super().__init__(id, classes, children=[form])

This form is rendered using:

csrf_token = ... # for example, using `flask_wtf.csrf.generate_csrf`
WordInputForm(csrf_token=csrf_token).render()

which could theoretically be used as the output of an @app.route-decorated function. Normally you would embed it within a page layout, etc. The result.

Metadata

Release files for flask-composed-views 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flask-composed-views 0.0.3
File Size Uploaded
flask_composed_views-0.0.3.tar.gz 8.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flask-composed-views 0.0.3
File Interpreter ABI Platform
flask_composed_views-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 19.9 kB

Release files / flask_composed_views-0.0.3.tar.gz

Download URL flask_composed_views-0.0.3.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
83fd63d7de3deebaf520f5e47c9b0675ea241489693c236b0624ec61e1605036
BLAKE2b-256 checksum
How to use checksums
28d081321b0005857e35588400145f2262a470fb990c932e3e06d2b92affa756
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / flask_composed_views-0.0.3-py3-none-any.whl

Download URL flask_composed_views-0.0.3-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b0956c859d17921cb21f6b931759f78a0dd6e5b0744f8c13e5cb4dea04085d51
BLAKE2b-256 checksum
How to use checksums
2e649eec928fda0607db9885231452556b3a7fd49e7da4da4cc1e8faa5f807d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.1

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page