Add extra text in 3.1.1. Closes #29.

This commit is contained in:
Anna Sidwell 2018-04-02 19:59:37 +10:00
parent e4f4a5e73b
commit 50b5f67bab

View File

@ -1,6 +1,7 @@
from django.urls import reverse from django.urls import reverse
from django import forms from django import forms
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from django.utils.safestring import mark_safe
from crispy_forms.helper import FormHelper from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit, Layout, HTML, Fieldset, Div from crispy_forms.layout import Submit, Layout, HTML, Fieldset, Div
from crispy_forms.bootstrap import Tab, TabHolder, PrependedText, FormActions from crispy_forms.bootstrap import Tab, TabHolder, PrependedText, FormActions
@ -69,8 +70,53 @@ class ShortCaseStudyForm(BaseCaseStudyForm):
class LongCaseStudyForm(BaseCaseStudyForm): class LongCaseStudyForm(BaseCaseStudyForm):
"""Long version of the CaseStudy form.""" """Long version of the CaseStudy form."""
POSITIVE_CASE_TYPE_HELP = {
'CREP': _("We are using the World Wind Energy Association's Community Power definition, \
which is that a community project is one where at least \
two of the following three criteria are met:<br> \
1. Local stakeholders own the majority or all of a project,<br> \
2. Voting control rests with the community-based organization,<br> \
3. The majority of social and economic benefits are distributed locally."),
'EACP': _(""),
'PSEP': _(""),
'CORS': _("The extraction of non-renewable resources, such as iron, copper, \
rare-earth elements or other minerals and metals used in \
renewable technologies, directly from the Earth is by definition \
an unsustainable practice. Despite this, the extraction of such elements \
this way for use in the renewable energy transition is, to an extent, \
a necessary evil in the immediate term. Bearing this in mind, \
a case involving extraction may be considered 'positive' if it helps \
to reduce, overall, the need for more extraction; if it drastically \
reduces ecological harms often caused by mining and does not infringe \
on areas of high biodiversity; and if it meets outstanding social \
and human rights standards that are enjoyed and affirmed by \
host communities and other stakeholders. Such social standards include: \
ensuring communities, and especially indigenous peoples, \
enjoy their right to Free Prior and Informed Consent, \
which includes the right to reject projects; abiding by \
the UN's guiding principles on Business and Human Rights; \
full collaboration with the Extractive Industries Transparency Initiative, \
assuring excellence in the transparency of project financing, \
tax affairs and other transactions; the highest labour standards; \
equitable distribution of any benefits accruing from mining; \
respect for the rule of law and the constitutional rights of citizens \
in host countries."),
}
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(LongCaseStudyForm, self).__init__(*args, **kwargs) super(LongCaseStudyForm, self).__init__(*args, **kwargs)
POSITIVE_CASE_TYPE_CHOICES = [
(choice[0], mark_safe('<b>%s</b><br><span class="text-muted">%s</span>' % (choice[1], self.POSITIVE_CASE_TYPE_HELP[choice[0]])))
for choice in CaseStudy.POSITIVE_CASE_TYPE_CHOICES
]
self.fields['positive_case_type'] = forms.ChoiceField(
widget=forms.RadioSelect(),
choices=POSITIVE_CASE_TYPE_CHOICES
)
self.helper.form_action = reverse('long-form') self.helper.form_action = reverse('long-form')
self.helper.layout = Layout( self.helper.layout = Layout(
TabHolder( TabHolder(