Skip to main content

Python script to generate HTML forms and attach themas a Flask view func.

Project description

canonicalwebteam.form_generator

Flask extension that generates unique HTML forms based on json data and registers them to URLs.

Installation and usage

Install the project with pip: pip install canonicalwebteam.form-generator

You can then initialize it by passing a Flask app instance and path to the form template, and then load the forms:

from canonicalwebteam.form_generator import FormGenerator

form_template_path = "path/to/form-template.html"
form_loader = FormGenerator(app, form_template_path)
form_loader.load_forms()

You can then call the load_forms function from within a Jinja template. Providing a path for the form-data.json (required), a formId (optional) and isModal (optional):

{{ load_form('/aws', 1234) | safe }}
{{ load_form('/aws', 1234, True) | safe }}
{{ load_form('/aws', isModal=True) | safe }}

See the full guide for more information.

Local development

Running the project

This guide assumes you are using dotrun.

Include a relative path to the project in your requirements.txt (this example assumes both project exist in the same dir): -e ../form-generator

Run dotrun with a mounted additor: dotrun -m /path/to/canonicalwebteam.form-generator:../form-generator

A more detailed guide can be found here (internal only).

Linting

To use the standard linting rules of this project you should use Tox:

pip3 install tox  # Install tox
tox -e lint       # Check the format of Python code
tox -e format     # Reformat the Python code

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

canonicalwebteam_form_generator-2.1.1.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

canonicalwebteam_form_generator-2.1.1-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file canonicalwebteam_form_generator-2.1.1.tar.gz.

File metadata

File hashes

Hashes for canonicalwebteam_form_generator-2.1.1.tar.gz
Algorithm Hash digest
SHA256 da8ef2ffd3eed4dc57b64cde66bf1c53a3b8617681ef5ab593d42a17d5fcc045
MD5 34ec22791358a867db2d7f73335e2e60
BLAKE2b-256 b8a00f260be37283794b707fe183df66d32027a1d44e695b0886be345e57439b

See more details on using hashes here.

File details

Details for the file canonicalwebteam_form_generator-2.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for canonicalwebteam_form_generator-2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6104cd444c906e02a5fb2b3ce7868c7dba507b0f1150343d7e1500efb38bedf4
MD5 3d1c2c2a32e1598a265e2224f0127e2f
BLAKE2b-256 ed73598bca691cbd6bd4a37f0dae18045955141ffccbe945828798b4250c6de3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page