1,801
การแก้ไข
| บรรทัดที่ 810: | บรรทัดที่ 810: | ||
else: | else: | ||
# Do something. | # Do something. | ||
# Modify resp_dict as fit. | |||
return jsonify(resp_dict) | return jsonify(resp_dict) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| บรรทัดที่ 835: | บรรทัดที่ 836: | ||
* '''skip_validation''' ''(bool)'': Whether the form validation step is skipped. '''ONLY SET THIS IF THE FORM IS VALIDATED ELSEWHERE.''' | * '''skip_validation''' ''(bool)'': Whether the form validation step is skipped. '''ONLY SET THIS IF THE FORM IS VALIDATED ELSEWHERE.''' | ||
* '''month''' ''(date or datetime)'': (Only applies for dbtype {{code|lang=python|'data'}}) The month sub-directory of the database. If not given, the program infers the month from the session time. | * '''month''' ''(date or datetime)'': (Only applies for dbtype {{code|lang=python|'data'}}) The month sub-directory of the database. If not given, the program infers the month from the session time. | ||
|- | |- style="vertical-align:top;" | ||
| '''Returns''' || | | '''Returns''' || | ||
* '''db_mod_code''' ''(int or {{code|lang=python|None}})'' | * '''db_mod_code''' ''(int or {{code|lang=python|None}})'': The returned value can be: | ||
* '''new_entry''' ''(CuneiModel instance or dict)'' | ** '''{{code|lang=python|None}}''': Indicate a '''permission error'''. | ||
* '''resp_dict''' ''(dict)'' | ** '''{{code|lang=python|2}}''': For a successful/failed '''addition''' attempt. | ||
** '''{{code|lang=python|3}}''': For a successful/failed '''edit''' attempt. | |||
** '''{{code|lang=python|4}}''': For a successful/failed '''deletion''' attempt. | |||
* '''new_entry''' ''(CuneiModel instance or dict or {{code|lang=python|None}})'': CuneiModel instance or a dict representing the successfully added/edited entry. Returned {{code|lang=python|None}} for a failed attempt. | |||
* '''resp_dict''' ''(dict or int)'': | |||
** '''For a successful/failed attempt''': The {{code|data}} dict to be sent to the client-side. This function takes care of the '''{{code|lang=python|'data'}}''', '''{{code|lang=python|'flash_messages'}}''', and '''{{code|lang=python|'err'}}''' keys. | |||
** '''For a permission error''': Integer '''{{code|lang=python|403}}'''. | |||
|} | |} | ||