FlaskTrytonWTF
This project is intend to be used for extendig the capabilities of flask using tryton as backend issiue/info: info@omniasolutions.eu
##Form: Extend the Flask-WTF capability usin tryton model to bind data in an imput form
You can use this extention like a normal FlaskForm Just remember to add trytonObject and the field that you like to see in your input form we also inser the submit button to push the data to tryton.
from FlaskTrytonWTF import FTWTF
...
...
...
class MyTrytonForm(FTWTF.TFlaskForm):
trytonObject = tryton.pool.get('my.tryton.object')
tryton_fields = {'field_1': {},
'field_2': {},
'field_3': {}
}
submitLable = "Submit"
@app.route('/input_form', methods=['GET', 'POST'])
@tryton.transaction()
def input_form():
form = MyTrytonForm()
if form.validate_on_submit():
data_submitted = form.trytonSubmit() # DO NOT FORGET TO CALL THE TRYTON SUBMIT IN ORDER DO FLUSH THE DATA
# ALSO THE DATA SUBMITTED IS RETURNED AS DICTIONAY OF VALUES
# SO YOU CAN USE IF !!
return render_template('show_input_confirmation.html', title='Conferma', form=data_submitted)
return render_template('input_form.html', form=form)
##Table: Extend the Flask-Table capability usin tryton model to bind data in read only mode
@app.route('/test_query', methods=['GET', 'POST'])
@login_required
@tryton.transaction()
def test_query():
from FlaskTrytonWTF import FTFT
class MyTestTable(FTFT.FTTable):
trytonObject = tryton.pool.get('my.tryton.object')
tryton_fields = [] #empty dict means all the data stored in the my.tryton.object
#tryton_fields = ['field_1', 'field_2'] # show anly the specifie fields on the table
table = MyTestTable()
return render_template("test_query.html",
table=table)
Metadata
Release files for FlaskTrytonWTF 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| FlaskTrytonWTF-0.0.4.tar.gz | 5.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| FlaskTrytonWTF-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.5 kB
Release files / FlaskTrytonWTF-0.0.4.tar.gz
| Download URL | FlaskTrytonWTF-0.0.4.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8421a8a2b3dca8406a47d7efa9412855e48449404a3c61d48d5a66d01bfb7c0f
|
|
BLAKE2b-256 checksum How to use checksums |
0e0a45aebad240287681e1b25a6b53a03b556ea87415128bf0534bf894935453
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.7.3
|
Release files / FlaskTrytonWTF-0.0.4-py3-none-any.whl
| Download URL | FlaskTrytonWTF-0.0.4-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
316a76dba5b91b6706c455f5d554fc511fac121d52e9cd1652c60aac283bbbc6
|
|
BLAKE2b-256 checksum How to use checksums |
ac32ca892db8afc769b4b3e7d1cc4295669d1a01f46c1cde52c72d373af1686e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.7.3
|