changeset 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 565d653a15d3
children 876ae5e23690
files README sat_website/local_settings.py sat_website/utils.py
diffstat 3 files changed, 58 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/README	Thu Jan 22 17:25:59 2015 +0100
+++ b/README	Tue Jan 27 07:52:33 2015 +0100
@@ -35,9 +35,33 @@
 
 The following values can be set in site's settings.py:
 
-	SAT_LINK_PATH = '/path/to/sat_link.tar.bz2' #the link should point to a SàT archive in the form sat-version.tar.bz2
-	SAT_DL_PREFIX = 'ftp://ftp.goffi.org/sat' #this prefix will be joined to the filename pointed by the previous link
-	SAT_DL_PATH = 'ftp://ftp.goffi.org/sat/sat.tar.bz2' #if set, this link will be used instead of the joined dl_prefix + filename
+    # this link should point to a SàT archive in the form sat-version.tar.bz2
+    SAT_LINK_PATH = '/path/to/sat_link.tar.bz2'
+
+    # this prefix will be joined to the filename pointed by the previous link
+    SAT_DL_PREFIX = 'ftp://ftp.goffi.org/sat'
+
+    # if set, this link will be used instead of the joined dl_prefix + filename
+    SAT_DL_PATH = 'ftp://ftp.goffi.org/sat/sat.tar.bz2'
+
+    # URL to Libervia online demo
+    LIBERVIA_DEMO_URL = 'https://www.libervia.org'
+
+    # Actual number of members
+    ASSO_MEMBERS_ACTUAL = 3400
+
+    # Target number of members
+    ASSO_MEMBERS_TARGET = 6000
+
+    # Available amount to finance the association (in euros)
+    ASSO_FINANCE_ACTUAL = 40000
+
+    # Target amount to finance the association (in euros)
+    ASSO_FINANCE_TARGET = 60000
+
+    # Subscription amounts defined in the Rules of Procedure
+    ASSO_SUBSCR_AMOUNTS = (0, 10, 20, 30, 50, 80, 100)
+
 
 Note that the Django application "markdown_deux" ( https://github.com/trentm/django-markdown-deux ) is required.
 For more information, check the local_settings.py file which is distributed in the sat_website directory.
--- a/sat_website/local_settings.py	Thu Jan 22 17:25:59 2015 +0100
+++ b/sat_website/local_settings.py	Tue Jan 27 07:52:33 2015 +0100
@@ -100,3 +100,10 @@
 SAT_LINK_PATH = '/srv/ftp/sat/sat.tar.bz2'
 SAT_DL_PREFIX = 'ftp://ftp.goffi.org/sat'
 #SAT_DL_PATH = 'ftp://ftp.goffi.org/sat/sat.tar.bz2'
+LIBERVIA_DEMO_URL = 'https://www.libervia.org'
+
+ASSO_MEMBERS_ACTUAL = 3400
+ASSO_MEMBERS_TARGET = 6000
+ASSO_FINANCE_ACTUAL = 34000
+ASSO_FINANCE_TARGET = 60000
+ASSO_SUBSCR_AMOUNTS = (0, 10, 20, 30, 50, 80, 100)
--- 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