1,801
การแก้ไข
| บรรทัดที่ 849: | บรรทัดที่ 849: | ||
=== Data Fetching Route === | === Data Fetching Route === | ||
Below is an example for Flask route that handles a data fetch request for CuneiForm. Again, this template is ideal for forms appearing on multiple pages but shares roughly the same fetch logic. | Below is an example for Flask route that handles a data fetch request for CuneiForm. Again, this template is ideal for forms appearing on multiple pages but shares roughly the same fetch logic. | ||
<syntaxhighlight lang='python' line=1> | |||
@<blueprint>.route("<submit_path>", methods=["POST"]) | |||
def <function_name>(*args): | |||
# Fetch, calculate, modify data to display on the form. | |||
return {'<field_name0>':<value0>, '<field_name1>':<value1>, ...} | |||
</syntaxhighlight> | |||
Useful fetching-type functions include, but not limited to, '''{{code|grab_some_entries}}''' and '''{{code|prefetch_all_docs}}'''. | |||
=== All-in-one Route === | === All-in-one Route === | ||