Through to row 87

This commit is contained in:
Anna Sidwell 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', 'location_context',
'type_of_ecosystem', 'type_of_ecosystem',
'describe_ecosystem', 'describe_ecosystem',
'people_affected_indigenous', 'affected_communities',
'people_affected_other',
'project_status', 'project_status',
'synopsis', 'synopsis',
'full_description', 'full_description',
@ -210,17 +209,40 @@ class LongCaseStudyForm(BaseCaseStudyForm):
in host countries."), 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): 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( self.fields['positive_case_type'] = forms.ChoiceField(
widget=forms.RadioSelect(), 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 required=False
) )
@ -253,6 +275,7 @@ class LongCaseStudyForm(BaseCaseStudyForm):
Fieldset( Fieldset(
_("Ownership and finance"), _("Ownership and finance"),
'project_owners', 'project_owners',
'consultants_contractors',
'shareholders', 'shareholders',
'financial_institutions', 'financial_institutions',
'financial_institutions_other', 'financial_institutions_other',

View File

@ -54,20 +54,23 @@ class CaseStudy(models.Model):
# Choice lists for drop-downs # Choice lists for drop-downs
SECTOR_CHOICES = ( SECTOR_CHOICES = (
('RN', _('Renewable Energy Generation')), ('RN', _('Renewable energy generation project')),
('PG', _('Power Grids')), ('PG', _('Energy networks and energy storage facilities')),
('SM', _('Supply of Minerals')), ('SM', _('Supply chain and lifecycle management')),
) )
POSITIVE_NEGATIVE_CHOICES = ( POSITIVE_NEGATIVE_CHOICES = (
('P', _('Positive')), ('P', _('There is/was an organising process in favour of the project')),
('N', _('Negative')) ('N', _('There is/was an organising process against the project')),
('X', _('There is/was no organising process')),
('U', _('Unsure/unknown'))
) )
LAND_OWNERSHIP_CHOICES = ( LAND_OWNERSHIP_CHOICES = (
('PRI', _('Private Land')), ('PRI', _('Private land')),
('PUB', _('Public Land')), ('PUB', _('Public/state land')),
('COM', _('Community Land')), ('COM', _('Community/communal/customary land')),
('CON', _('Contested/in conflict')),
('OTH', _('Other')), ('OTH', _('Other')),
) )
@ -88,10 +91,22 @@ class CaseStudy(models.Model):
('URBAN', _('Urban')) ('URBAN', _('Urban'))
) )
AFFECTED_COMMUNITIES_CHOICES = (
('INDIG', _('Indigenous')),
('AFRO', _('Afro-descendants')),
('MIG', _('Migrants')),
('REF', _('Refugees')),
('OTHER', _('Other communities or identities')),
)
PROJECT_STATUS_CHOICES = ( PROJECT_STATUS_CHOICES = (
('EXSTNG', _('Existing Project')), ('INIT', _('Initiation/ideation')),
('UCONST', _('Under Construction')), ('PROJCD', _('In planning and design')),
('PROJCD', _('Projected Project')), ('FAIL', _('Failed')),
('UCONST', _('Under construction')),
('EXSTNG', _('In operation')),
('DECOMM', _('Undergoing decommissioning')),
('END', _('Decommissioned]')),
) )
FINANCIAL_INSTITUTIONS = ( FINANCIAL_INSTITUTIONS = (
@ -265,8 +280,10 @@ class CaseStudy(models.Model):
# 1.1 # 1.1
entry_name = models.CharField( entry_name = models.CharField(
verbose_name=_("Entry Name"), verbose_name=_("Entry Name"),
help_text=_("Enter the name of the entry. This should usually be the\ help_text=_("This should usually be the name of the project. \
name of project."), If you are writing this case study in a language not used \
in the locale of its project, you should provide its local name \
first, as well as any translated name."),
max_length=128 max_length=128
) )
@ -286,8 +303,8 @@ class CaseStudy(models.Model):
# 1.3 # 1.3
positive_or_negative = models.CharField( positive_or_negative = models.CharField(
verbose_name=_("Positive or negative?"), verbose_name=_("What is the relationship of local community organization(s) to this project?"),
help_text=_("Is the case study a positive case or a negative case?"), help_text=_("Please reflect the perspective of the organization(s) or person(s) describing the case."),
max_length=1, max_length=1,
choices=POSITIVE_NEGATIVE_CHOICES choices=POSITIVE_NEGATIVE_CHOICES
) )
@ -306,16 +323,22 @@ class CaseStudy(models.Model):
# 1.5.2 # 1.5.2
land_ownership = models.CharField( land_ownership = models.CharField(
verbose_name=_("Land ownership"), verbose_name=_("Land ownership / tenure"),
help_text=_("What type of ownership does the land fall under?"), help_text=_("What type of ownership does the land fall under?"),
max_length=3, max_length=3,
choices=LAND_OWNERSHIP_CHOICES choices=LAND_OWNERSHIP_CHOICES
) )
# 1.5.3 # 1.5.3
land_ownership_details = models.CharField( land_ownership_details = models.TextField(
verbose_name=_("Land ownership details"), verbose_name=_("Land ownership details"),
help_text=_("Please specify details about land ownership"), help_text=_("<p class='text-muted'>Please specify details about land ownership, including \
conflicting claims, unrecognized customary rights, conflicts \
around land lease or purchase contracts, etc.\
\
<p class='text-muted'>We understand this is a difficult question, so \
please try to provide just the information you know. \
If we have any major questions we will ask them in the moderation process.</p>"),
max_length=256, max_length=256,
blank=True, blank=True,
) )
@ -323,8 +346,7 @@ class CaseStudy(models.Model):
# 1.5.4 # 1.5.4
location_context = models.CharField( location_context = models.CharField(
verbose_name=_("Location"), verbose_name=_("Location"),
help_text=_("Select the context that is most applicable to this case\ help_text=_("Select the context that is most applicable to this case study."),
study."),
max_length=3, max_length=3,
choices=LOCATION_CONTEXT_CHOICES choices=LOCATION_CONTEXT_CHOICES
) )
@ -332,7 +354,6 @@ class CaseStudy(models.Model):
# 1.5.5 # 1.5.5
type_of_ecosystem = MultiSelectField( type_of_ecosystem = MultiSelectField(
verbose_name=_("Type(s) of ecosystem"), verbose_name=_("Type(s) of ecosystem"),
help_text=_("Select the most relevant type(s)."),
max_length=56, max_length=56,
choices=TYPE_OF_ECOSYSTEM_CHOICES, choices=TYPE_OF_ECOSYSTEM_CHOICES,
blank=True blank=True
@ -341,10 +362,16 @@ class CaseStudy(models.Model):
# 1.5.5.3 # 1.5.5.3
describe_ecosystem = models.TextField( describe_ecosystem = models.TextField(
verbose_name=_("Describe the ecosystem"), verbose_name=_("Describe the ecosystem"),
help_text=_("In your own words, add more detail about the ecosystem."),
) )
# Was 1.5.6; spec not being followed here after request from client affected_communities = MultiSelectField(
verbose_name=_("Communities or identities present in the project area"),
max_length=50,
choices=AFFECTED_COMMUNITIES_CHOICES,
blank=True
)
# XXX Delete after migration
people_affected_indigenous = models.TextField( people_affected_indigenous = models.TextField(
verbose_name=_("Indigenous people affected"), verbose_name=_("Indigenous people affected"),
help_text=_("What group or groups of indigenous people are affected by this project? \ help_text=_("What group or groups of indigenous people are affected by this project? \
@ -352,6 +379,7 @@ class CaseStudy(models.Model):
blank=True blank=True
) )
# XXX Delete after migration
people_affected_other = models.TextField( people_affected_other = models.TextField(
verbose_name=_("Non-indigenous people affected"), verbose_name=_("Non-indigenous people affected"),
help_text=_("What other group or groups of people are affected by this project? \ help_text=_("What other group or groups of people are affected by this project? \
@ -361,17 +389,17 @@ class CaseStudy(models.Model):
# 1.6 # 1.6
project_status = models.CharField( project_status = models.CharField(
verbose_name=_("Status of Project"), verbose_name=_("Status of project"),
help_text=_("What is the status of the current project?"),
max_length=6, max_length=6,
choices=PROJECT_STATUS_CHOICES choices=PROJECT_STATUS_CHOICES
) )
# 1.7 # 1.7
start_year = models.IntegerField( start_year = models.IntegerField(
verbose_name=_("Start year"), verbose_name=_("Construction start year"),
help_text=_("Select the year the project was started. \ help_text=_("Select the year project construction began. If the project is not yet \
If the project hasn't begun, select the projected start year."), in construction, select the assumed start year as detailed in company \
information or media."),
choices=YEAR_CHOICES, choices=YEAR_CHOICES,
blank=True, blank=True,
null=True null=True
@ -379,9 +407,10 @@ class CaseStudy(models.Model):
# 1.8 # 1.8
completion_year = models.IntegerField( completion_year = models.IntegerField(
verbose_name=_("Completion year"), verbose_name=_("Operation start year"),
help_text=_("Select the year the project was completed. \ help_text=_("Select the year the project's operation and maintenance (O&M) phase began. \
If the project hasn't finished, select the projected completion year."), If the project is not yet in operation, select the year operation is expected \
to begin as detailed in company information or media."),
choices=YEAR_CHOICES, choices=YEAR_CHOICES,
default=None, default=None,
null=True, null=True,
@ -399,18 +428,26 @@ class CaseStudy(models.Model):
# 1.10 # 1.10
full_description = models.TextField( full_description = models.TextField(
verbose_name=_("Full Description"), verbose_name=_("Full Description"),
help_text=_("Describe the project in full. Separate paragraphs with a\ help_text=_("Describe the project in full. Separate paragraphs with two\
new line Please add as much detail as you feel is necessary\ new lines. Please add as much detail as you feel is necessary\
here.") here.")
) )
# 1.11 # 1.11
project_owners = models.TextField( project_owners = models.TextField(
verbose_name=_("Project and facility owners"), verbose_name=_("Project and facility owners"),
help_text=_("List companies or organisations that own the project and/or facilities. Separate with a new line."), help_text=_("List companies or organisations that own the project and/or facilities. \
Provide company numbers etc. if available. Separate with a new line."),
blank=True blank=True
) )
consultants_contractors = models.TextField(
verbose_name=_("Consultants and contractors"),
help_text=_("List consultants, planners or organisations that are doing the planning, \
construction, operation or maintenance work relating to the project \
and/or facilities. Separate each with a new line."),
)
# 1.12 # 1.12
shareholders = models.TextField( shareholders = models.TextField(
verbose_name=_("Shareholders of the project owners"), verbose_name=_("Shareholders of the project owners"),
@ -421,8 +458,8 @@ class CaseStudy(models.Model):
# 1.13.1 # 1.13.1
financial_institutions = MultiSelectField( financial_institutions = MultiSelectField(
verbose_name=_("Financial institutions"), verbose_name=_("Financial institutions"),
help_text=_("Select any financial institutions that have or are considering extending \ help_text=_("Select any financial institutions (public or private) that have, \
loans or guarantees to the project."), or are considering, extending loans or guarantees to the project."),
choices=FINANCIAL_INSTITUTIONS, choices=FINANCIAL_INSTITUTIONS,
blank=True blank=True
) )
@ -437,9 +474,11 @@ class CaseStudy(models.Model):
# 1.14 # 1.14
energy_customers = models.TextField( energy_customers = models.TextField(
verbose_name=_("Energy consumers"), verbose_name=_("Energy service consumers/off-takers"),
help_text=_("List any wholesale energy customers that take energy from the development. E.g. 'national \ help_text=_("List any energy customers/off-takers that take energy from the \
grids' or private energy suppliers. Please separate with a newline."), development. E.g. 'national grids' or private energy suppliers. \
Also refer to if carbon markets, credits, blockchain etc. are \
involved in the process. Please separate with a new line."),
blank=True blank=True
) )
@ -500,7 +539,8 @@ class CaseStudy(models.Model):
direct_comms = models.TextField( direct_comms = models.TextField(
verbose_name=_("Reports of direct communications"), verbose_name=_("Reports of direct communications"),
help_text=_("Add any reports of direct communication between community members and \ help_text=_("Add any reports of direct communication between community members and \
representatives of developers/companies/investors."), representatives of developers/companies/investors. If you have files \
to upload, you can do this in 'other documents' on the 'uploads' tab."),
blank=True, blank=True,
) )

View File

@ -137,6 +137,34 @@
}); });
} }
var analysisToggles = [
{
"input": "id_id_sector_of_economy_0_1",
"section": "power_generation_questions",
},
{
"input": "id_id_sector_of_economy_0_2",
"section": "power_grids_energy_storage_questions",
},
{
"input": "id_id_sector_of_economy_0_3",
"section": "mineral_commodity_questions",
},
]
function showAnalysisSection() {
for (const option of analysisToggles) {
const input = document.getElementById(option.input)
const section = document.getElementById(option.section)
if (input.checked) {
$(section).show();
} else {
$(section).hide();
}
}
}
// Helper functions // Helper functions
function show(tag) { function show(tag) {
$(tag).show(); $(tag).show();
@ -180,6 +208,13 @@
conditionalCheckboxes.forEach(function(item){ conditionalCheckboxes.forEach(function(item){
$(item.checkbox).change(); $(item.checkbox).change();
}); });
for (const option of analysisToggles) {
const input = document.getElementById(option.input)
$(input).on('change', showAnalysisSection);
$(input).trigger('change');
}
}); });
</script> </script>