# HG changeset patch # User souliane # Date 1422972882 -3600 # Node ID dfe7139dae0aa57d26ce636f09b2498da7e02ddc # Parent d2c45f4ba57e2cc86b2800bc15dd446b07cfdc7e add links to the statutes and rules of the association in the adhesion form diff -r d2c45f4ba57e -r dfe7139dae0a README --- a/README Tue Jan 27 18:23:39 2015 +0100 +++ b/README Tue Feb 03 15:14:42 2015 +0100 @@ -61,6 +61,10 @@ # Subscription amounts as defined in the Rules of Procedure ASSO_SUBSCR_AMOUNTS = (0, 10, 20, 30, 50, 80, 100) + # URL to the Statutes and Rules of the association + ASSO_URL_STATUTES = 'http://repos.goffi.org/sat_docs/raw-file/tip/association/statuts.pdf' + ASSO_URL_RULES = 'http://repos.goffi.org/sat_docs/raw-file/tip/association/r%C3%A8glement%20int%C3%A9rieur.pdf' + 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. diff -r d2c45f4ba57e -r dfe7139dae0a sat_website/forms.py --- a/sat_website/forms.py Tue Jan 27 18:23:39 2015 +0100 +++ b/sat_website/forms.py Tue Feb 03 15:14:42 2015 +0100 @@ -21,9 +21,10 @@ along with Foobar. If not, see . """ -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _, string_concat from django.utils.html import format_html from django import forms +from django.conf import settings from collections import OrderedDict from email import email import utils @@ -92,7 +93,16 @@ section_6 = Section(label=_(u'Comment')) comment = CharField(required=False, label=_(u"Comment"), placeholder="", widget=forms.Textarea(attrs={'rows': 3})) - confirm = BooleanField(label=_(u"I read the Rules of Procedure")) + def html_link(url, label): + return string_concat('', label, '') + + agreement_label = [_(u"I read the "), + html_link(settings.ASSO_URL_STATUTES, _(u"Statutes")), + _(u" and "), + html_link(settings.ASSO_URL_RULES, _(u"Rules")), + _(u" of the association, and agree to both of them."), + ] + agreement_confirmation = BooleanField(label=string_concat(*agreement_label)) def sections(self): sections = OrderedDict() diff -r d2c45f4ba57e -r dfe7139dae0a sat_website/local_settings.py --- a/sat_website/local_settings.py Tue Jan 27 18:23:39 2015 +0100 +++ b/sat_website/local_settings.py Tue Feb 03 15:14:42 2015 +0100 @@ -122,3 +122,7 @@ # Subscription amounts as defined in the Rules of Procedure ASSO_SUBSCR_AMOUNTS = (0, 10, 20, 30, 50, 80, 100) + +# URL to the Statutes and Rules of the association +ASSO_URL_STATUTES = 'http://repos.goffi.org/sat_docs/raw-file/tip/association/statuts.pdf' +ASSO_URL_RULES = 'http://repos.goffi.org/sat_docs/raw-file/tip/association/r%C3%A8glement%20int%C3%A9rieur.pdf' diff -r d2c45f4ba57e -r dfe7139dae0a sat_website/utils.py --- a/sat_website/utils.py Tue Jan 27 18:23:39 2015 +0100 +++ b/sat_website/utils.py Tue Feb 03 15:14:42 2015 +0100 @@ -49,11 +49,17 @@ return result def get_libervia_demo_url(): - """Return the URL to Libervia online demo""" + """Returns the URL to Libervia online demo.""" return settings.LIBERVIA_DEMO_URL +def get_asso_urls(): + """Returns URLs related to the association""" + return {'asso_url_statutes': settings.ASSO_URL_STATUTES, + 'asso_url_rules': settings.ASSO_URL_RULES + } + def get_asso_finance_status(): - """Returns information about the financement of the association""" + """Returns information about the financing of the association.""" def get_items(actual, target, prefix): actual = int(actual) target = int(target) @@ -70,4 +76,5 @@ return items def get_asso_subscr_amounts(): + """Returns the subscription amounts as defined in the Rules of the association.""" return settings.ASSO_SUBSCR_AMOUNTS diff -r d2c45f4ba57e -r dfe7139dae0a sat_website/views.py --- a/sat_website/views.py Tue Jan 27 18:23:39 2015 +0100 +++ b/sat_website/views.py Tue Feb 03 15:14:42 2015 +0100 @@ -88,15 +88,18 @@ context["projects_infos"] = utils.get_projects_infos(PROJECTS_INFOS) elif category == "adhesion": context.update(utils.get_asso_finance_status()) + context.update(utils.get_asso_urls()) elif category == "adhesion_form": if request.method == 'POST': form = forms.RegistrationForm(request.POST) + form.process_submitted_data() if form.is_valid(): category = 'thank_you' else: form = forms.RegistrationForm(initial={'subscription_amount': 10, 'payment_method': 'card'}) context['form'] = form + context.update(utils.get_asso_urls()) def all_keys(cats): subcats = [value[1].keys() for value in cats.values() if isinstance(value, tuple)] diff -r d2c45f4ba57e -r dfe7139dae0a templates/sat_website/adhesion.html --- a/templates/sat_website/adhesion.html Tue Jan 27 18:23:39 2015 +0100 +++ b/templates/sat_website/adhesion.html Tue Feb 03 15:14:42 2015 +0100 @@ -62,8 +62,8 @@
{% trans "Official documents" %}
diff -r d2c45f4ba57e -r dfe7139dae0a templates/sat_website/adhesion_form.html --- a/templates/sat_website/adhesion_form.html Tue Jan 27 18:23:39 2015 +0100 +++ b/templates/sat_website/adhesion_form.html Tue Feb 03 15:14:42 2015 +0100 @@ -51,10 +51,12 @@ {% elif field.field.widget|is_checkbox %}
- -
+ + {% else %} {% if field.field.required %}