Mercurial > sat_legacy_website
changeset 40:dfe7139dae0a
add links to the statutes and rules of the association in the adhesion form
author | souliane <souliane@mailoo.org> |
---|---|
date | Tue, 03 Feb 2015 15:14:42 +0100 |
parents | d2c45f4ba57e |
children | 1a0f24401866 |
files | README sat_website/forms.py sat_website/local_settings.py sat_website/utils.py sat_website/views.py templates/sat_website/adhesion.html templates/sat_website/adhesion_form.html |
diffstat | 7 files changed, 40 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- 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.
--- 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 <http://www.gnu.org/licenses/>. """ -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('<a target="#" href="', url, '">', label, '</a>') + + 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()
--- 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'
--- 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
--- 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)]
--- 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 @@ </div> <h5 class="alert alert-success">{% trans "Official documents" %}</h5> <div class="info"> - <p><a target="#" href="http://repos.goffi.org/sat_docs/raw-file/tip/association/statuts.pdf">{% trans "Statuses of the association" %}</a> (fr)</p> - <p><a target="#" href="http://repos.goffi.org/sat_docs/raw-file/tip/association/r%C3%A8glement%20int%C3%A9rieur.pdf">{% trans "Rules of Procedure" %}</a> (fr)</p> + <p><a target="#" href="{{ asso_url_statutes }}">{% trans "Statutes of the association" %}</a> (fr)</p> + <p><a target="#" href="{{ asso_url_rules }}">{% trans "Rules of the association" %}</a> (fr)</p> <p><a target="#" href="http://repos.goffi.org/sat_docs/file/tip/association">{% trans "Minutes" %}</a> (fr)</p> </div> </div>
--- 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 @@ </div> {% elif field.field.widget|is_checkbox %} <div class="checkbox"> - <label> - {{ field }}{{ field.label }} <span class="glyphicon glyphicon-asterisk"></span> - </label> - </div> + <label> + {% autoescape off %} + {{ field }}{{ field.label }} <span class="glyphicon glyphicon-asterisk"></span> + {% endautoescape %} + </label> + </div> {% else %} {% if field.field.required %} <div class="input-group">