Utils
hypha.apply.funds.utils
¶
status_and_phases_mapping
module-attribute
¶
status_and_phases_mapping = {'received': ['need-screening', 'proposal-received'], 'in-discussion': ['ready-for-discussion'], 'internal-review': ['internal-review'], 'more-information': ['more-information-required'], 'invited-for-proposal': ['invited-for-proposal'], 'external-review': ['external-review'], 'ready-for-determination': ['ready-for-determination', 'ready-for-preliminary-determination', 'ready-for-final-determination'], 'accepted': ['accepted'], 'dismissed': ['dismissed']}
render_icon
¶
get_or_create_default_screening_statuses
¶
Get the default screening decisions set.
If the default for yes and no doesn't exit. First yes and first no screening decisions created should be set as default
Source code in hypha/apply/funds/utils.py
model_form_initial
¶
This is a copy of django.forms.models.model_to_dict from the django version 2.2.x. It helps to provide initial to BaseModelForm with fields as empty list[].
Return a dict containing the data in instance
suitable for passing as
a Model Form's initial
keyword argument.
fields
is an optional list of field names. If provided, return only the
named.
exclude
is an optional list of field names. If provided, exclude the
named from the returned dict, even if they are listed in the fields
argument.
Source code in hypha/apply/funds/utils.py
get_statuses_as_params
¶
export_submissions_to_csv
¶
Source code in hypha/apply/funds/utils.py
format_submission_sum_value
¶
Formats a submission value dict that contains a key of value__sum
Parameters:
-
submission_value
(dict
) –the dict containing the
value_sum
Returns:
-
str | None
–either a string of the formatted sum value or
None
if invalid
Source code in hypha/apply/funds/utils.py
is_filter_empty
¶
Determines if a given FilterSet has valid query params or if they're empty
Parameters:
-
filter
(FilterSet
) –the FilterSet to evaluate
Returns:
-
bool
(bool
) –True if filter has valid params, False if empty
Source code in hypha/apply/funds/utils.py
get_copied_form_name
¶
Create the name of the form to be copied
By default, takes the orginal forms name and adds (Copied on %Y-%m-%d %H:%M:%S.%f)
If a timestamp exists on the original_form_name, it will be replaced.
This works even if the Copied on
string is translated.
Parameters:
-
original_form_name
(str
) –the name of the form being duplicated
Returns:
-
str
(str
) –name of the copied form