Mercurial > sat_legacy_website
diff sat_website/utils.py @ 31:31d196cf3b34
add settings ASSO_MEMBERS_*, ASSO_FINANCE_* and LIBERVIA_DEMO_URL
author | souliane <souliane@mailoo.org> |
---|---|
date | Tue, 27 Jan 2015 07:52:33 +0100 |
parents | a49aa1b823f6 |
children | d2c45f4ba57e |
line wrap: on
line diff
--- a/sat_website/utils.py Thu Jan 22 17:25:59 2015 +0100 +++ b/sat_website/utils.py Tue Jan 27 07:52:33 2015 +0100 @@ -38,3 +38,27 @@ return (None, None) return (dl_path, version) + +def get_libervia_demo_url(): + """Return the URL to Libervia online demo""" + return settings.LIBERVIA_DEMO_URL + +def get_asso_finance_status(): + """Returns information about the financement of the association""" + def get_items(actual, target, prefix): + actual = int(actual) + target = int(target) + perc = actual * 100 / target + return {prefix + 'actual': actual, + prefix + 'target': target, + prefix + 'left': target - actual, + prefix + 'perc': perc, + prefix + 'perc_left': 100 - perc, + } + + items = get_items(settings.ASSO_FINANCE_ACTUAL, settings.ASSO_FINANCE_TARGET, 'asso_finance_') + items.update(get_items(settings.ASSO_MEMBERS_ACTUAL, settings.ASSO_MEMBERS_TARGET, 'asso_members_')) + return items + +def get_asso_subscr_amounts(): + return settings.ASSO_SUBSCR_AMOUNTS