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',
'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',

View File

@ -54,20 +54,23 @@ class CaseStudy(models.Model):
# Choice lists for drop-downs
SECTOR_CHOICES = (
('RN', _('Renewable Energy Generation')),
('PG', _('Power Grids')),
('SM', _('Supply of Minerals')),
('RN', _('Renewable energy generation project')),
('PG', _('Energy networks and energy storage facilities')),
('SM', _('Supply chain and lifecycle management')),
)
POSITIVE_NEGATIVE_CHOICES = (
('P', _('Positive')),
('N', _('Negative'))
('P', _('There is/was an organising process in favour of the project')),
('N', _('There is/was an organising process against the project')),
('X', _('There is/was no organising process')),
('U', _('Unsure/unknown'))
)
LAND_OWNERSHIP_CHOICES = (
('PRI', _('Private Land')),
('PUB', _('Public Land')),
('COM', _('Community Land')),
('PRI', _('Private land')),
('PUB', _('Public/state land')),
('COM', _('Community/communal/customary land')),
('CON', _('Contested/in conflict')),
('OTH', _('Other')),
)
@ -88,10 +91,22 @@ class CaseStudy(models.Model):
('URBAN', _('Urban'))
)
AFFECTED_COMMUNITIES_CHOICES = (
('INDIG', _('Indigenous')),
('AFRO', _('Afro-descendants')),
('MIG', _('Migrants')),
('REF', _('Refugees')),
('OTHER', _('Other communities or identities')),
)
PROJECT_STATUS_CHOICES = (
('EXSTNG', _('Existing Project')),
('UCONST', _('Under Construction')),
('PROJCD', _('Projected Project')),
('INIT', _('Initiation/ideation')),
('PROJCD', _('In planning and design')),
('FAIL', _('Failed')),
('UCONST', _('Under construction')),
('EXSTNG', _('In operation')),
('DECOMM', _('Undergoing decommissioning')),
('END', _('Decommissioned]')),
)
FINANCIAL_INSTITUTIONS = (
@ -265,8 +280,10 @@ class CaseStudy(models.Model):
# 1.1
entry_name = models.CharField(
verbose_name=_("Entry Name"),
help_text=_("Enter the name of the entry. This should usually be the\
name of project."),
help_text=_("This should usually be the name of the 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
)
@ -286,8 +303,8 @@ class CaseStudy(models.Model):
# 1.3
positive_or_negative = models.CharField(
verbose_name=_("Positive or negative?"),
help_text=_("Is the case study a positive case or a negative case?"),
verbose_name=_("What is the relationship of local community organization(s) to this project?"),
help_text=_("Please reflect the perspective of the organization(s) or person(s) describing the case."),
max_length=1,
choices=POSITIVE_NEGATIVE_CHOICES
)
@ -306,16 +323,22 @@ class CaseStudy(models.Model):
# 1.5.2
land_ownership = models.CharField(
verbose_name=_("Land ownership"),
verbose_name=_("Land ownership / tenure"),
help_text=_("What type of ownership does the land fall under?"),
max_length=3,
choices=LAND_OWNERSHIP_CHOICES
)
# 1.5.3
land_ownership_details = models.CharField(
land_ownership_details = models.TextField(
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,
blank=True,
)
@ -323,8 +346,7 @@ class CaseStudy(models.Model):
# 1.5.4
location_context = models.CharField(
verbose_name=_("Location"),
help_text=_("Select the context that is most applicable to this case\
study."),
help_text=_("Select the context that is most applicable to this case study."),
max_length=3,
choices=LOCATION_CONTEXT_CHOICES
)
@ -332,7 +354,6 @@ class CaseStudy(models.Model):
# 1.5.5
type_of_ecosystem = MultiSelectField(
verbose_name=_("Type(s) of ecosystem"),
help_text=_("Select the most relevant type(s)."),
max_length=56,
choices=TYPE_OF_ECOSYSTEM_CHOICES,
blank=True
@ -341,10 +362,16 @@ class CaseStudy(models.Model):
# 1.5.5.3
describe_ecosystem = models.TextField(
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(
verbose_name=_("Indigenous people affected"),
help_text=_("What group or groups of indigenous people are affected by this project? \
@ -352,6 +379,7 @@ class CaseStudy(models.Model):
blank=True
)
# XXX Delete after migration
people_affected_other = models.TextField(
verbose_name=_("Non-indigenous people affected"),
help_text=_("What other group or groups of people are affected by this project? \
@ -361,17 +389,17 @@ class CaseStudy(models.Model):
# 1.6
project_status = models.CharField(
verbose_name=_("Status of Project"),
help_text=_("What is the status of the current project?"),
verbose_name=_("Status of project"),
max_length=6,
choices=PROJECT_STATUS_CHOICES
)
# 1.7
start_year = models.IntegerField(
verbose_name=_("Start year"),
help_text=_("Select the year the project was started. \
If the project hasn't begun, select the projected start year."),
verbose_name=_("Construction start year"),
help_text=_("Select the year project construction began. If the project is not yet \
in construction, select the assumed start year as detailed in company \
information or media."),
choices=YEAR_CHOICES,
blank=True,
null=True
@ -379,9 +407,10 @@ class CaseStudy(models.Model):
# 1.8
completion_year = models.IntegerField(
verbose_name=_("Completion year"),
help_text=_("Select the year the project was completed. \
If the project hasn't finished, select the projected completion year."),
verbose_name=_("Operation start year"),
help_text=_("Select the year the project's operation and maintenance (O&M) phase began. \
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,
default=None,
null=True,
@ -399,18 +428,26 @@ class CaseStudy(models.Model):
# 1.10
full_description = models.TextField(
verbose_name=_("Full Description"),
help_text=_("Describe the project in full. Separate paragraphs with a\
new line Please add as much detail as you feel is necessary\
help_text=_("Describe the project in full. Separate paragraphs with two\
new lines. Please add as much detail as you feel is necessary\
here.")
)
# 1.11
project_owners = models.TextField(
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
)
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
shareholders = models.TextField(
verbose_name=_("Shareholders of the project owners"),
@ -421,8 +458,8 @@ class CaseStudy(models.Model):
# 1.13.1
financial_institutions = MultiSelectField(
verbose_name=_("Financial institutions"),
help_text=_("Select any financial institutions that have or are considering extending \
loans or guarantees to the project."),
help_text=_("Select any financial institutions (public or private) that have, \
or are considering, extending loans or guarantees to the project."),
choices=FINANCIAL_INSTITUTIONS,
blank=True
)
@ -437,9 +474,11 @@ class CaseStudy(models.Model):
# 1.14
energy_customers = models.TextField(
verbose_name=_("Energy consumers"),
help_text=_("List any wholesale energy customers that take energy from the development. E.g. 'national \
grids' or private energy suppliers. Please separate with a newline."),
verbose_name=_("Energy service consumers/off-takers"),
help_text=_("List any energy customers/off-takers that take energy from the \
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
)
@ -500,7 +539,8 @@ class CaseStudy(models.Model):
direct_comms = models.TextField(
verbose_name=_("Reports of direct communications"),
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,
)

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
function show(tag) {
$(tag).show();
@ -180,6 +208,13 @@
conditionalCheckboxes.forEach(function(item){
$(item.checkbox).change();
});
for (const option of analysisToggles) {
const input = document.getElementById(option.input)
$(input).on('change', showAnalysisSection);
$(input).trigger('change');
}
});
</script>