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.""" """Gets the 11 number video ID from the video field."""
return parse.urlparse(self.video).path 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: class Meta:
verbose_name_plural = 'case studies' verbose_name_plural = 'case studies'

View File

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