ข้ามไปเนื้อหา

ผลต่างระหว่างรุ่นของ "CuneiForm"

เพิ่มขึ้น 1,295 ไบต์ ,  8 เมษายน 2567
บรรทัดที่ 146: บรรทัดที่ 146:
* '''prefix''' ''(str)'': This value is reflected in FlaskForm's {{code|_prefix}} and CuneiForm's {{code|_id}} attributes during initiation. The {{code|_prefix}} attribute is not directly accessed if one follows the usual coding pattern of CuneiFox.
* '''prefix''' ''(str)'': This value is reflected in FlaskForm's {{code|_prefix}} and CuneiForm's {{code|_id}} attributes during initiation. The {{code|_prefix}} attribute is not directly accessed if one follows the usual coding pattern of CuneiFox.
* '''form_name''' ''(str or LazyString)'': The human-readable form name. This is very rarely accessed (examples include Permission forms and Setting Forms which require the form names to be explicitly and dynamically rendered on the client-side) and usually omitted.
* '''form_name''' ''(str or LazyString)'': The human-readable form name. This is very rarely accessed (examples include Permission forms and Setting Forms which require the form names to be explicitly and dynamically rendered on the client-side) and usually omitted.
* ''' gen_del''': The way CuneiFox handles data input and data deletion requires fields named '''submit''' ''(SubmitField)'', '''del_submit''' ''(SubmitField)'', and '''is_del''' ''(BooleanField)'' to be present in most of the forms.<br>So, CuneiFox allows developers to define a form with these 3 fields omitted, then provide a not-None argument in this position to automatically create said fields.
* '''gen_del''': The module to store, at runtime, the parallel CuneiForm class with generic submit-delete field set. (See description under [[#Submit-delete Field Set|Section: Submit-delete Field Set]].
* '''has_files''' ''(bool)'': Whether the form contains one or more fields for files. ''(This has most likely been made obsolete and is always omitted.)''
* '''Other keyword arguments''': See notes under sections below.
|- style="vertical-align:top;"
|- style="vertical-align:top;"
| '''Returns''' || A new FlaskForm-CuneiFox object.
| '''Returns''' || A new FlaskForm-CuneiFox object.
|}
|}
=== Submit-delete Field Set ===
The way CuneiFox handles data input and deletion requires fields named '''submit''' ''(SubmitField)'', '''del_submit''' ''(SubmitField)'', and '''is_del''' ''(BooleanField)'' to be present in most forms. So, CuneiFox allows developers to define a form with these 3 fields omitted, then provide a not-None {{code|gen_del}} argument upon initiation.
The way CuneiFox goes about this is to create a parallel FlaskForm-CuneiForm class with these 3 fields added, then store the new class in the module specified in the argument for repeated use. The {{code|gen_del}} argument can be:
* {{code|lang=python|str module_code}}: In this case, runtime class is stored within the module's 'forms' sub-module.
* {{code|lang=python|[str module_code, str submodule_name]}}: In this case, the new class is stored in the specified sub-module.
'''NOTE THAT''' this feature does not override any similarly named field in the original form definition. For example, if the definition of the form already contains a 'submit' field, only 'del_submit' and 'is_del' fields are injected.
=== Notes on Keyword Arguments ===
==== MASTER-adjacents ====
==== Know Your Place ====
==== Sequence and Column Names ====
==== Getting Data ====
==== Sending Data ====


== Design & Pre-made Scripts ==
== Design & Pre-made Scripts ==