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) and a formId (optional):
{{ load_form('/aws', 1234) | 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file canonicalwebteam_form_generator-2.0.1.tar.gz.
File metadata
- Download URL: canonicalwebteam_form_generator-2.0.1.tar.gz
- Upload date:
- Size: 15.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4117f62c7a372e7a0ef23fad111890af5d66ce04c14d0026427514b8d216605b
|
|
| MD5 |
beb102d0ea10b62a5ec69063eaa9afa9
|
|
| BLAKE2b-256 |
136975b3c016eec97f65200461ce6355ddd3d72550cd9b482a3879d141313ed7
|
File details
Details for the file canonicalwebteam_form_generator-2.0.1-py3-none-any.whl.
File metadata
- Download URL: canonicalwebteam_form_generator-2.0.1-py3-none-any.whl
- Upload date:
- Size: 16.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26e2ab1995c168cd46a7cd4ae420d01d82bc5924b5ca50f77731057f154b576e
|
|
| MD5 |
18ecccad1857ad3f7e78d8ac076a8c26
|
|
| BLAKE2b-256 |
b7083056f7448153b1d89f35d5caf12d9df3e60cf8a1a81a5fbcded918e93d73
|