Update case study display

This commit is contained in:
Anna Sidwell 2018-12-02 00:31:26 +00:00
parent 5c7d4005f0
commit 23c1279f61
2 changed files with 136 additions and 119 deletions

View File

@ -1115,30 +1115,6 @@ class CaseStudy(models.Model):
"""Gets the 11 number video ID from the video field."""
return parse.urlparse(self.video).path
def get_negative_case_reasons_no_other(self):
"""Return a list of negative case reasons, minus the 'other' choice (if selected)"""
choices = self.get_negative_case_reasons_list()
return choices
def get_renewable_generation_detail(self):
"""Prepend appropriate descriptive text when accessing renewable generation type."""
if self.generation_technology:
if self.generation_technology.endswith('WE'):
return _('Wind energy') + " " + self.get_generation_technology_display()
elif self.generation_technology.endswith('PV'):
return _('Photovoltaic electricity') + " " + self.get_generation_technology_display()
elif self.generation_technology.endswith('HYD'):
return _('Hydroelectric') + " " + self.get_generation_technology_display()
elif self.generation_technology == 'OTHR':
return self.generation_technology_other
else:
return self.get_generation_technology_display()
else:
return ""
class Meta:
verbose_name_plural = 'case studies'

View File

@ -117,12 +117,13 @@ dd ul { padding-left: 0; margin-left: 0; }
{% endif %}
{% if case_study.land_ownership %}
<dt>{% trans "Land ownership" %}:
{% if case_study.land_ownership == 'OTH' %}
<dd>{{ case_study.land_ownership_details }}
{% else %}
<dd>{{ case_study.get_land_ownership_display }}
<dt>{% trans "Land ownership and tenure" %}:
<dd>
{% if case_study.land_ownership != 'OTH' %}
{{ case_study.get_land_ownership_display }}
{% endif %}
{{ case_study.land_ownership_details | linebreaks }}
{% endif %}
{% if case_study.type_of_ecosystem %}
@ -137,13 +138,10 @@ dd ul { padding-left: 0; margin-left: 0; }
</dl>
{% if case_study.affects_indigenous %}
{% if case_study.affected_communities %}
<h2>{% trans "Affected groups of people" %}</h2>
<h3>{% trans "Indigenous people" %}</h3>
{{ case_study.people_affected_indigenous | linebreaks }}
<h3>{% trans "Non-indigenous people" %}</h3>
{{ case_study.get_affected_communities_display }}
{{ case_study.people_affected_other | linebreaks }}
{% endif %}
@ -156,12 +154,12 @@ dd ul { padding-left: 0; margin-left: 0; }
{% endif %}
{% if case_study.start_year %}
<dt>{% trans "Start year" %}:
<dt>{% trans "Construction start year" %}:
<dd id="start_year">{{ case_study.start_year }}
{% endif %}
{% if case_study.completion_year %}
<dt>{% trans "Completion year" %}:
<dt>{% trans "Operation start year" %}:
<dd id="completion_year">{{ case_study.completion_year }}
{% endif %}
@ -170,6 +168,11 @@ dd ul { padding-left: 0; margin-left: 0; }
<dd id="project_owners">{{ case_study.project_owners }}
{% endif %}
{% if case_study.consultants_contractors %}
<dt>{% trans "Consultants and contractors" %}:
<dd id="consultants_contractors">{{ case_study.consultants_contractors }}
{% endif %}
{% if case_study.shareholders %}
<dt>{% trans "Shareholders of the project owners" %}:
<dd id="shareholders">{{ case_study.shareholders }}
@ -177,7 +180,9 @@ dd ul { padding-left: 0; margin-left: 0; }
{% if case_study.financial_institutions %}
<dt>{% trans "Financial institutions" %}:
<dd id="financial_institutions">{{ case_study.financial_institutions }}
<dd id="financial_institutions">
{{ case_study.get_financial_institutions_display }}
{{ case_study.financial_institutions_other }}
{% endif %}
{% if case_study.energy_customers %}
@ -241,17 +246,24 @@ dd ul { padding-left: 0; margin-left: 0; }
<h1>Technical and economic analysis</h1>
{% if case_study.sector_of_economy == 'RN' %}
<!-- renewables / 2.1 -->
<!-- generation -->
<dl>
{% if case_study.generation_type %}
<dt>{% trans "What is being generated?" %}:
<dd id="generation_type">
{{ case_study.get_generation_type_detail }}
{% endif %}
{% if case_study.generation_technology %}
<dt>{% trans "Generation technology" %}:
<dd id="generation_technology">
{{ case_study.get_renewable_generation_detail }}
<p>{{ case_study.get_generation_technology_display }}
<p>{{ case_study.energy_details }}
{% endif %}
{% if case_study.generation_technology == 'BIOG' or case_study.generation_technology == 'OTHB' %}
<dt>{% trans "Feedstock" %}:
{% if case_study.generation_technology == 'BIO' %}
<dt>{% trans "Bio-energy feedstock" %}:
<dd id="biomass_detail">
{{ case_study.biomass_detail }}
{% endif %}
@ -274,49 +286,45 @@ dd ul { padding-left: 0; margin-left: 0; }
${{ case_study.total_investment | intcomma }} (USD)
{% endif %}
{% if case_study.technical_or_economic_details %}
{% if case_study.additional_technical_details %}
<dt>{% trans "Additional technical or economic details" %}:
<dd id="technical_or_economic_details">
{{ case_study.technical_or_economic_details | linebreaks }}
<dd id="additional_technical_details">
{{ case_study.additional_technical_details | linebreaks }}
{% endif %}
</dl>
{% elif case_study.sector_of_economy == 'PG' %}
<!-- batteries or storage / 2.2 -->
{% elif case_study.sector_of_economy == 'PG' or case_study.sector_of_economy == 'ST' %}
<!-- storage/grids -->
<dl>
{% if case_study.power_technology %}
<dt>{% trans "Generation technology" %}:
<dd id="power_technology">
{% if case_study.power_technology == 'OT' %}
{{ case_study.power_technology_other }}
{% else %}
{{ case_study.power_technology }}
{% endif %}
<p>{{ case_study.power_technology }}
<p>{{ case_study.power_technology_other }}
{% endif %}
{% if case_study.energy_storage_capacity %}
<dt>{% trans "Energy storage capacity" %}:
<dd id="energy_storage_capacity">
{{ case_study.energy_storage_capacity }} TODO UNITS?
{{ case_study.energy_storage_capacity }} kWh
{% endif %}
{% if case_study.energy_transmission_capacity %}
<dt>{% trans "Energy transmission capacity" %}:
<dd id="energy_transmission_capacity">
{{ case_study.energy_transmission_capacity }} TODO UNITS?
{{ case_study.energy_transmission_capacity }} kW
{% endif %}
{% if case_study.contractor_or_supplier_of_technology %}
<dt>{% trans "Contractor and/or supplier of technology" %}:
<dd id="contractor_or_supplier_of_technology">
{{ case_study.contractor_or_supplier_of_technology }}
{% if case_study.generation_equipment_supplier %}
<dt>{% trans "Generation equipment supplier" %}:
<dd id="generation_equipment_supplier">
{{ case_study.generation_equipment_supplier }}
{% endif %}
{% if case_study.approximate_total_investment %}
{% if case_study.total_investment %}
<dt>{% trans "Approximate total investment" %}:
<dd id="approximate_total_investment">
${{ case_study.approximate_total_investment | intcomma }} (USD)
<dd id="total_investment">
${{ case_study.total_investment | intcomma }} (USD)
{% endif %}
{% if case_study.additional_technical_details %}
@ -324,30 +332,33 @@ dd ul { padding-left: 0; margin-left: 0; }
<dd id="additional_technical_details">
{{ case_study.additional_technical_details | linebreaks }}
{% endif %}
</dl>
{% elif case_study.sector_of_economy == 'SM' %}
<!-- minerals / 2.3 -->
<!-- mining -->
<dl>
{% if case_study.minerals_or_commodities %}
<dt>{% trans "Mineral commodity/commodities" %}:
<dt>{% trans "Primary mineral mined" %}:
<dd id="minerals_or_commodities">
{% if case_study.minerals_or_commodities == 'OTR' %}
{{ case_study.minerals_or_commodities_other }}
{% else %}
{{ case_study.get_minerals_or_commodities_display }}
{% if case_study.minerals_or_commodities != 'OTR' %}
<p>{{ case_study.get_minerals_or_commodities_display }}
{% endif %}
{{ case_study.minerals_or_commodities_other | linebreaks }}
{% endif %}
{% if case_study.use_in_energy_economy %}
<dt>{% trans "Potential use in renewable energy economy" %}:
<dd id="use_in_energy_economy">
{% if case_study.use_in_energy_economy == 'OTR' %}
{{ case_study.use_in_energy_economy_other }}
{% else %}
{% if case_study.use_in_energy_economy != 'OTR' %}
{{ case_study.get_use_in_energy_economy_display }}
{% endif %}
{% if case_study.use_in_energy_economy_other %}
{{ case_study.use_in_energy_economy_other }}
{% endif %}
{% endif %}
{% if case_study.project_life_span %}
@ -363,7 +374,7 @@ dd ul { padding-left: 0; margin-left: 0; }
{% endif %}
{% if case_study.projected_production_of_commodities %}
<dt>{% trans "Projected production of key commodities" %}:
<dt>{% trans "Estimated production of key commodities" %}:
<dd id="projected_production_of_commodities">
{{ case_study.projected_production_of_commodities }}
{% endif %}
@ -381,29 +392,85 @@ dd ul { padding-left: 0; margin-left: 0; }
{% endif %}
</dl>
{% elif case_study.sector_of_economy == 'MA' %}
<!-- manufacturing -->
<dl>
{% if case_study.manufacturing_type %}
<dt>{% trans "Manufacturing process" %}:
<dd id="manufacturing_type">
{{ case_study.get_manufacturing_type_display }}
{% endif %}
{% if case_study.manufacturing_description %}
<dt>{% trans "Description" %}:
<dd id="manufacturing_description">
{{ case_study.manufacturing_description }}
{% endif %}
{% if case_study.manufacturing_related_tech %}
<dt>{% trans "Related technology" %}:
<dd id="manufacturing_related_tech">
{{ case_study.get_manufacturing_related_tech_display }}
{% endif %}
{% if case_study.manufacturing_factors %}
<dt>{% trans "Remarkable factors" %}:
<dd id="manufacturing_factors">
{{ case_study.get_manufacturing_factors_display }}
{% endif %}
{% if case_study.manufacturing_factors_description %}
<dt>{% trans "More info" %}:
<dd id="manufacturing_factors_description">
{{ case_study.manufacturing_factors_description }}
{% endif %}
{% if case_study.manufacturing_factors_ownership %}
<dt>{% trans "Ownership information" %}:
<dd id="manufacturing_factors_ownership">
{{ case_study.manufacturing_factors_ownership }}
{% endif %}
</dl>
{% endif %}
<h2>Socio-economic analysis</h2>
<dl>
<dt>{% trans "Case type" %}
<dt>{% trans "Kind of organising process around this project" %}
<dd>{{ case_study.get_positive_or_negative_display }}
{% if case_study.positive_or_negative == "P" %}
<!-- positive case -->
<dt>{% trans "This is case is about" %}:
<dd id="positive_case_type">
<ul>
{% if case_study.positive_case_type %}
<dt>{% trans "Type of positive case" %}:
<dd id="positive_case_type">
{{ case_study.get_positive_case_type_display }}
{% for text in case_study.get_positive_case_type_list %}
<li>{{ text }}
{% endfor %}
{% endif %}
{% if case_study.negative_case_reasons %}
{% for text in case_study.get_negative_case_reasons_list %}
<li>{{ text }}
{% endfor %}
{% endif %}
</ul>
{% if case_study.socioeconomic_benefits %}
<dt>{% trans "Socio-economic benefits" %}:
<dt>{% trans "Socio-economic impacts" %}
<dd id="socioeconomic_benefits">
{{ case_study.socioeconomic_benefits }}
{% endif %}
{% if case_study.isolated_or_widespread %}
<dt>{% trans "Is the project part of developments which are causing a cumulative effect?" %}
<dd id="isolated_or_widespread">
{{ case_study.isolated_or_widespread }}
{% endif %}
{% if case_study.key_actors_involved %}
<dt>{% trans "Key actors involved" %}:
<dd id="key_actors_involved">
@ -411,53 +478,23 @@ dd ul { padding-left: 0; margin-left: 0; }
{% endif %}
{% if case_study.project_status_detail %}
<dt>{% trans "Current status of project" %}:
<dt>{% trans "Current status of the case" %}:
<dd id="project_status_detail">
{{ case_study.project_status_detail }}
{% endif %}
{% if case_study.obstacles_and_hindrances %}
<dt>{% trans "Obstacles and hindrances" %}:
<dt>{% trans "Current status of the organizing process around this case" %}:
<dd id="obstacles_and_hindrances">
{{ case_study.obstacles_and_hindrances }}
{% endif %}
{% if case_study.identified_partnerships %}
<dt>{% trans "Identified partnerships" %}:
<dd id="identified_partnerships">
{{ case_study.identified_partnerships }}
{% endif %}
{% else %}
<!-- negative case -->
{% if case_study.negative_case_reasons %}
<dt>{% trans "Reasons this is a negative case study" %}:
<dd id="negative_case_reasons">
<ul>
{% for text in case_study.get_negative_case_reasons_no_other %}
<li>{{ text }}
{% endfor %}
{% if case_study.negative_case_reasons_other %}
<li>{{ case_study.negative_case_reasons_other }}
{% endif %}
</ul>
{% endif %}
{% if case_study.negative_socioenvironmental_impacts %}
<dt>{% trans "Negative socio-environmental impacts" %}:
<dt>{% trans "Socio-environmental impacts" %}:
<dd id="negative_socioenvironmental_impacts">
{{ case_study.negative_socioenvironmental_impacts }}
{% endif %}
{% if case_study.isolated_or_widespread %}
<dt>{% trans "Isolated or commonplace" %}:
<dd id="isolated_or_widespread">
{{ case_study.isolated_or_widespread }}
{% endif %}
{% if case_study.when_did_organising_start %}
<dt>{% trans "Local organising efforts began" %}:
<dd id="when_did_organising_start">
@ -470,12 +507,16 @@ dd ul { padding-left: 0; margin-left: 0; }
{{ case_study.who_has_been_involved }}
{% endif %}
{% if case_study.potential_partnerships %}
<dt>{% trans "Potential partnerships" %}:
<dd id="potential_partnerships">
{{ case_study.potential_partnerships }}
{% if case_study.participation_mechanisms %}
<dt>{% trans "Mechanisms of participation" %}:
<dd id="participation_mechanisms">
{{ case_study.participation_mechanisms }}
{% endif %}
{% if case_study.identified_partnerships %}
<dt>{% trans "Identified partnerships" %}:
<dd id="identified_partnerships">
{{ case_study.identified_partnerships }}
{% endif %}
</dl>