biweeklybudget.flaskapp.filters module¶
-
biweeklybudget.flaskapp.filters.
acct_icon_filter
(acct)[source]¶ Given an Account, return the proper classes for an account type icon for it.
Parameters: acct (biweeklybudget.models.account.Account) – the account Returns: string icon classes Return type: str
-
biweeklybudget.flaskapp.filters.
ago_filter
(dt)[source]¶ Format a datetime using humanize.naturaltime, “ago”
Parameters: dt (datetime.datetime) – datetime to compare to now Returns: ago string Return type: str
-
biweeklybudget.flaskapp.filters.
budget_cell_filter
(d)[source]¶ Given a dictionary of budget IDs to names and amounts like that returned by
_dict_for_trans()
, return the<td>
content for those budgets.
-
biweeklybudget.flaskapp.filters.
dateymd_filter
(dt)[source]¶ Format a datetime using %Y-%m-%d
Parameters: dt (datetime.datetime) – datetime to format Returns: formatted date Return type: str
-
biweeklybudget.flaskapp.filters.
dollars_filter
(x)[source]¶ Format as currency using
fmt_currency()
.Parameters: x – currency amount, int, float, decimal, etc. Returns: formatted currency Return type: str
-
biweeklybudget.flaskapp.filters.
isodate_filter
(dt)[source]¶ Format a datetime using %Y-%m-%d %H:%M:%S
Parameters: dt (datetime.datetime) – datetime to format Returns: formatted date Return type: str
-
biweeklybudget.flaskapp.filters.
period_panel_color_filter
(x)[source]¶ Given the remaining amount for a pay period, return “red” if less than zero, “yellow” if less than 100, or otherwise “green”.
Parameters: x (float) – PayPeriod remaining amount Returns: “red”, “yellow” or “green” Return type: str
-
biweeklybudget.flaskapp.filters.
pluralize_filter
(word, number=1)[source]¶ If number is greater than one, return word with an “s” appended, else return word unmodified.
Parameters: - word (string) – the word to pluralize or not
- number (int) – the number to check for greater-than-one-ness
Returns: word, pluralized or not
Return type: