comparison 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
comparison
equal deleted inserted replaced
39:d2c45f4ba57e 40:dfe7139dae0a
19 19
20 You should have received a copy of the GNU Affero General Public License 20 You should have received a copy of the GNU Affero General Public License
21 along with Foobar. If not, see <http://www.gnu.org/licenses/>. 21 along with Foobar. If not, see <http://www.gnu.org/licenses/>.
22 """ 22 """
23 23
24 from django.utils.translation import ugettext_lazy as _ 24 from django.utils.translation import ugettext_lazy as _, string_concat
25 from django.utils.html import format_html 25 from django.utils.html import format_html
26 from django import forms 26 from django import forms
27 from django.conf import settings
27 from collections import OrderedDict 28 from collections import OrderedDict
28 from email import email 29 from email import email
29 import utils 30 import utils
30 31
31 32
90 ref = CharField(required=False, label=_(u"Reference"), placeholder=_(u"Adherent number in case of a renewal")) 91 ref = CharField(required=False, label=_(u"Reference"), placeholder=_(u"Adherent number in case of a renewal"))
91 92
92 section_6 = Section(label=_(u'Comment')) 93 section_6 = Section(label=_(u'Comment'))
93 comment = CharField(required=False, label=_(u"Comment"), placeholder="", widget=forms.Textarea(attrs={'rows': 3})) 94 comment = CharField(required=False, label=_(u"Comment"), placeholder="", widget=forms.Textarea(attrs={'rows': 3}))
94 95
95 confirm = BooleanField(label=_(u"I read the Rules of Procedure")) 96 def html_link(url, label):
97 return string_concat('<a target="#" href="', url, '">', label, '</a>')
98
99 agreement_label = [_(u"I read the "),
100 html_link(settings.ASSO_URL_STATUTES, _(u"Statutes")),
101 _(u" and "),
102 html_link(settings.ASSO_URL_RULES, _(u"Rules")),
103 _(u" of the association, and agree to both of them."),
104 ]
105 agreement_confirmation = BooleanField(label=string_concat(*agreement_label))
96 106
97 def sections(self): 107 def sections(self):
98 sections = OrderedDict() 108 sections = OrderedDict()
99 current_section = None 109 current_section = None
100 for field in self: 110 for field in self: