diff sat_website/forms.py @ 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 9d553570cc61
children 1a0f24401866
line wrap: on
line diff
--- 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()