Through to row 87

This commit is contained in:
2018-11-24 16:54:39 +00:00
parent 90f05fc92a
commit 5c4e9c330d
3 changed files with 146 additions and 48 deletions

View File

@ -100,8 +100,7 @@ class ShortCaseStudyForm(BaseCaseStudyForm):
'location_context',
'type_of_ecosystem',
'describe_ecosystem',
'people_affected_indigenous',
'people_affected_other',
'affected_communities',
'project_status',
'synopsis',
'full_description',
@ -210,17 +209,40 @@ class LongCaseStudyForm(BaseCaseStudyForm):
in host countries."),
}
SECTOR_HELP = {
'RN': _("including electricity, heat or combined heat and power generation"),
'PG': "",
'SM': _("including supply of minerals and/or manufacturing/processing of equipment used in the renewable energy economy")
}
def add_explanatory_text(self, model_choices, explanatory_text):
return [
(
choice[0],
mark_safe('<b>%s</b><br><span class="text-muted">%s</span>' %
(choice[1], explanatory_text[choice[0]])
)
) for choice in model_choices
]
def __init__(self, *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,
choices=self.add_explanatory_text(
CaseStudy.POSITIVE_CASE_TYPE_CHOICES,
self.POSITIVE_CASE_TYPE_HELP,
),
required=False
)
self.fields['sector_of_economy'] = forms.ChoiceField(
widget=forms.RadioSelect(),
choices=self.add_explanatory_text(
CaseStudy.SECTOR_CHOICES,
self.SECTOR_HELP
),
required=False
)
@ -253,6 +275,7 @@ class LongCaseStudyForm(BaseCaseStudyForm):
Fieldset(
_("Ownership and finance"),
'project_owners',
'consultants_contractors',
'shareholders',
'financial_institutions',
'financial_institutions_other',