biweeklybudget.flaskapp.views.formhandlerview module¶
-
class
biweeklybudget.flaskapp.views.formhandlerview.
FormHandlerView
[source]¶ Bases:
flask.views.MethodView
-
_validate_date_ymd
(key, data, errors)[source]¶ Validate a YYYY-mm-dd date field.
Parameters: Returns: updated err_list
Return type:
-
_validate_decimal
(key, data, errors)[source]¶ Validate a Decimal field.
Parameters: Returns: updated err_list
Return type:
-
_validate_float
(key, data, errors)[source]¶ Validate a float field.
Parameters: Returns: updated err_list
Return type:
-
_validate_int
(key, data, errors)[source]¶ Validate an integer field.
Parameters: Returns: updated err_list
Return type:
-
_validate_not_empty
(key, data, errors)[source]¶ Validate that a string is not empty.
Parameters: Returns: updated err_list
Return type:
-
fix_string
(s)[source]¶ Strip a string. If the result is empty, return None. Otherwise return the result.
Parameters: s (str) – form data value Returns: stripped string or None
-
methods
= {'POST'}¶
-
post
()[source]¶ Handle a POST request for a form. Validate it, if valid update the DB.
Returns a JSON hash with the following structure:
‘errors’ -> hash of field names to list of error strings ‘error_message’ -> string error message ‘success’ -> boolean ‘success_message’ -> string success message
-