Merge branch 'feature/new-form' into 'master'

Closes #42

See merge request autonomic-cooperative/ojuso-map!4
This commit is contained in:
Anna Sidwell 2018-12-02 01:37:58 +00:00
commit e8e1d2cff6
12 changed files with 1276 additions and 711 deletions

View File

@ -0,0 +1,25 @@
# Generated by Django 2.1.1 on 2018-12-01 23:15
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('files', '0006_auto_20180928_1323'),
]
operations = [
migrations.AlterField(
model_name='file',
name='user',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='file', to=settings.AUTH_USER_MODEL),
),
migrations.AlterField(
model_name='imagefile',
name='user',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='imagefile', to=settings.AUTH_USER_MODEL),
),
]

View File

@ -15,6 +15,32 @@ from .models import CaseStudy, SpatialRefSys, PointOfInterest
from .widgets import JSONFileListWidget
SECTOR_HELP = {
'RN': _("including electricity, heat or combined heat and power generation"),
'PG': '',
'ST': _('Biological, chemical, electrical, electromagnetic, electrochemical, mechanical including gravitational potential, thermal etc.'),
'SM': _("including supply of minerals"),
'MA': '',
}
POWER_TECHNOLOGY_HELP = {
'PT': _('Lines, transformers, machinery etc.'),
'HN': _('District heating/cooling, etc.'),
'OT': '',
}
def add_explanatory_text(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
]
class MinimumZoomWidget(LeafletWidget):
geometry_field_class = 'MinimumZoomField'
@ -63,8 +89,8 @@ class BaseCaseStudyForm(forms.models.ModelForm):
self.helper.form_class = 'form-horizontal'
self.helper.form_method = 'post'
self.helper.form_action = 'add'
self.helper.label_class = 'col-lg-2'
self.helper.field_class = 'col-lg-8'
self.helper.label_class = 'col-md-3'
self.helper.field_class = 'col-md-9'
self.helper.include_media = False
class Meta:
@ -87,6 +113,16 @@ class ShortCaseStudyForm(BaseCaseStudyForm):
self.helper.form_action = reverse('short-form')
self.helper.add_input(Submit('submit', _('Submit'), css_class='btn-success center-block'))
# Duplicate code from long form, below...
self.fields['sector_of_economy'] = forms.ChoiceField(
widget=forms.RadioSelect(),
choices=add_explanatory_text(
CaseStudy.SECTOR_CHOICES,
SECTOR_HELP
),
required=False
)
class Meta(BaseCaseStudyForm.Meta):
fields = [
'entry_name',
@ -100,8 +136,7 @@ class ShortCaseStudyForm(BaseCaseStudyForm):
'location_context',
'type_of_ecosystem',
'describe_ecosystem',
'people_affected_indigenous',
'people_affected_other',
'affected_communities',
'project_status',
'synopsis',
'full_description',
@ -177,56 +212,67 @@ class LongCaseStudyForm(BaseCaseStudyForm):
initial=4326,
)
POSITIVE_CASE_TYPE_HELP = {
'CREP': _("We are using the World Wind Energy Association's Community Power definition, \
which is that a community project is one where at least \
two of the following three criteria are met:<br> \
1. Local stakeholders own the majority or all of a project,<br> \
2. Voting control rests with the community-based organization,<br> \
3. The majority of social and economic benefits are distributed locally."),
'EACP': _(""),
'PSEP': _(""),
'CORS': _("The extraction of non-renewable resources, such as iron, copper, \
rare-earth elements or other minerals and metals used in \
renewable technologies, directly from the Earth is by definition \
an unsustainable practice. Despite this, the extraction of such elements \
this way for use in the renewable energy transition is, to an extent, \
a necessary evil in the immediate term. Bearing this in mind, \
a case involving extraction may be considered 'positive' if it helps \
to reduce, overall, the need for more extraction; if it drastically \
reduces ecological harms often caused by mining and does not infringe \
on areas of high biodiversity; and if it meets outstanding social \
and human rights standards that are enjoyed and affirmed by \
host communities and other stakeholders. Such social standards include: \
ensuring communities, and especially indigenous peoples, \
enjoy their right to Free Prior and Informed Consent, \
which includes the right to reject projects; abiding by \
the UN's guiding principles on Business and Human Rights; \
full collaboration with the Extractive Industries Transparency Initiative, \
assuring excellence in the transparency of project financing, \
tax affairs and other transactions; the highest labour standards; \
equitable distribution of any benefits accruing from mining; \
respect for the rule of law and the constitutional rights of citizens \
in host countries."),
}
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'].label = ""
self.fields['negative_case_reasons'].label = ""
self.fields['positive_case_type'] = forms.ChoiceField(
self.fields['sector_of_economy'] = forms.ChoiceField(
widget=forms.RadioSelect(),
choices=POSITIVE_CASE_TYPE_CHOICES,
choices=add_explanatory_text(
CaseStudy.SECTOR_CHOICES,
SECTOR_HELP
),
required=False
)
self.fields['power_technology'] = forms.ChoiceField(
widget=forms.RadioSelect(),
choices=add_explanatory_text(
CaseStudy.POWER_TECHNOLOGY_CHOICES,
POWER_TECHNOLOGY_HELP
),
required=False
)
self.fields['project_owners'].required = True
self.fields['shareholders'].required = True
self.fields['socioeconomic_benefits'].label = \
'<span class="organising organising-vs">' + \
_('Socio-environmental impacts (negative and potentially positive)') + \
'</span>' + \
'<span class="organising organising-pro">' + \
_('Socio-environmental impacts (positive and potentially negative)') + \
'</span>' + \
'<span class="organising organising-none organising-idk">' + \
_('Socio-environmental impacts (positive and negative)') + \
'</span>'
self.fields['socioeconomic_benefits'].help_text = \
'<span class="organising organising-none organising-idk">' + \
_('Please expand on your response given in the full description on page one. \
We would expect benefits to go beyond emissions savings, paying rent for land, \
or complying with environmental or social legislation. Please include other \
reasons, noting that we aim to focus on projects with substantive impacts on \
vulnerable groups.') + \
'</span>' + \
'<span class="organising organising-vs">' + \
_('Please expand on your response given in the description. Note that we aim to \
focus on violation of land rights / human rights / collective rights, substantive \
negative impacts on vulnerable groups, aggression / threats / violence, \
severe environmental and/or cultural impacts, abusive labor practices, and \
corruption / governance issues, but feel free to cover any additional aspect \
that you consider relevant. Please also describe and analyze socio-environmental \
impacts that could be presented or considered as positive.') + \
'</span>' + \
'<span class="organising organising-pro">' + \
_('Please expand on your response given in the description. Please also describe \
and analyze socio-environmental impacts that could be considered as negative.') + \
'</span>'
self.helper.form_action = reverse('long-form')
self.helper.layout = Layout(
TabHolder(
@ -234,15 +280,21 @@ class LongCaseStudyForm(BaseCaseStudyForm):
'entry_name',
'location',
'country',
'shapefiles',
'shapefiles_files',
'coordinate_reference_system',
'name_of_territory_or_area',
'area_of_land',
'land_ownership',
'land_ownership_details',
'location_context',
'type_of_ecosystem',
'describe_ecosystem',
'people_affected_indigenous',
'affected_communities',
'people_affected_other',
'project_status',
'start_year',
'completion_year',
'synopsis',
'full_description',
'images',
@ -253,10 +305,10 @@ class LongCaseStudyForm(BaseCaseStudyForm):
Fieldset(
_("Ownership and finance"),
'project_owners',
'consultants_contractors',
'shareholders',
'financial_institutions',
'financial_institutions_other',
'energy_customers'
),
Fieldset(
_("Media reports and other communications"),
@ -273,31 +325,41 @@ class LongCaseStudyForm(BaseCaseStudyForm):
Tab(
_("Technical and economic analysis"),
'sector_of_economy',
Fieldset(
_("Power Generation Questions"),
Div(
'generation_type',
'generation_technology',
'biomass_detail',
'generation_technology_other',
'total_generation_capacity',
'generation_equipment_supplier',
'total_investment',
'technical_or_economic_details',
css_id="power_generation_questions"
css_class='power_generation_questions'
),
Fieldset(
_("Power Grids/Energy Storage Questions"),
Div(
'power_technology',
'power_technology_other',
'energy_storage_capacity',
'maximum_power_output',
'discharge_time',
'contractor_or_supplier_of_technology',
'approximate_total_investment',
'additional_technical_details',
css_id="power_grids_energy_storage_questions"
css_class='energy_network_questions'
),
Fieldset(
_("Mineral/Commodity Questions"),
Div(
'energy_details',
css_class='energy_generation_network_and_storage_questions'
),
Div(
'biomass_detail',
'total_generation_capacity',
css_class='power_generation_questions'
),
Div(
'energy_transmission_capacity',
css_class='energy_network_questions'
),
Div(
'energy_storage_capacity',
css_class='energy_storage_questions'
),
Div(
PrependedText('total_investment', 'USD $'),
'contractor_or_supplier_of_technology',
'energy_customers',
'additional_technical_details',
css_class='energy_generation_network_and_storage_questions'
),
Div(
'minerals_or_commodities',
'minerals_or_commodities_other',
'use_in_energy_economy',
@ -307,7 +369,16 @@ class LongCaseStudyForm(BaseCaseStudyForm):
'projected_production_of_commodities',
'type_of_extraction',
'associated_infrastructure',
css_id="mineral_commodity_questions"
css_class="mineral_commodity_questions"
),
Div(
'manufacturing_type',
'manufacturing_description',
'manufacturing_related_tech',
'manufacturing_factors',
'manufacturing_factors_description',
'manufacturing_ownership',
css_class="manufacturing_questions"
),
FormActions(
HTML("<a class='btn btn-primary btnPrevious'>"+_("Previous")+"</a>"),
@ -316,32 +387,31 @@ class LongCaseStudyForm(BaseCaseStudyForm):
),
Tab(
_("Socio-environmental analysis"),
HTML("<p>" + _("In the following, we expect the analysis to reflect the perspective of the organization(s) or person(s) describing the case.") + "</p>"),
'positive_or_negative',
Fieldset(
_("Positive Case Questions"),
'positive_case_type',
'socioeconomic_benefits',
'project_status_detail',
'obstacles_and_hindrances',
'identified_partnerships',
css_id="positive_case_questions"
),
Fieldset(
_("Negative Case Questions"),
'negative_case_reasons',
'negative_case_reasons_other',
'negative_socioenvironmental_impacts',
'isolated_or_widespread',
'when_did_organising_start',
'who_has_been_involved',
'participation_mechanisms',
'potential_partnerships',
'wants_conversation_with_ojuso',
css_id="negative_case_questions"
),
Div(
'key_actors_involved',
css_id="common_questions"
HTML("<label class='col-md-3 control-label'>What kind of case is this entry about?</label>"),
Div(
'positive_case_type',
'negative_case_reasons',
css_class='col-md-9',
),
css_class='form-group',
),
'negative_case_reasons_other',
'socioeconomic_benefits',
'isolated_or_widespread',
'key_actors_involved',
'project_status_detail',
'obstacles_and_hindrances',
'negative_socioenvironmental_impacts',
'when_did_organising_start',
'who_has_been_involved',
'participation_mechanisms',
'identified_partnerships',
'wants_conversation_with_ojuso',
Div(
css_class="common_questions"
),
FormActions(
HTML("<a class='btn btn-primary btnPrevious'>"+_("Previous")+"</a>"),
@ -356,6 +426,8 @@ class LongCaseStudyForm(BaseCaseStudyForm):
PrependedText('contact_twitter', '@', placeholder='username'),
'contact_facebook',
'contact_other',
'shown_on_other_platforms',
'shown_on_other_platforms_detail',
FormActions(
HTML("<a class='btn btn-primary btnPrevious'>"+_("Previous")+"</a>"),
HTML("<a class='btn btn-primary btnNext pull-right'>"+_("Next")+"</a>")
@ -367,12 +439,6 @@ class LongCaseStudyForm(BaseCaseStudyForm):
'official_project_documents_files',
'other_documents',
'other_documents_files',
'shapefiles',
'shapefiles_files',
'coordinate_reference_system',
'name_of_territory_or_area',
'shown_on_other_platforms',
'shown_on_other_platforms_detail',
FormActions(
HTML("<a class='btn btn-primary btnPrevious'>"+_("Previous")+"</a>"),
Submit('submit', _('Submit'), css_class="btn-success pull-right")

View File

@ -0,0 +1,309 @@
# Generated by Django 2.1.1 on 2018-12-01 23:15
from django.db import migrations, models
import django.db.models.deletion
import django_extensions.db.fields
import multiselectfield.db.fields
class Migration(migrations.Migration):
dependencies = [
('map', '0071_point_of_interest'),
]
operations = [
migrations.AlterModelOptions(
name='pointofinterest',
options={'verbose_name_plural': 'points of interest'},
),
migrations.RemoveField(
model_name='casestudy',
name='generation_technology_other',
),
migrations.AddField(
model_name='casestudy',
name='affected_communities',
field=multiselectfield.db.fields.MultiSelectField(blank=True, choices=[('INDIG', 'Indigenous'), ('AFRO', 'Afro-descendants'), ('MIG', 'Migrants'), ('REF', 'Refugees'), ('OTHER', 'Other communities or identities')], max_length=50, verbose_name='Communities or identities present in the project area'),
),
migrations.AddField(
model_name='casestudy',
name='consultants_contractors',
field=models.TextField(blank=True, 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.', verbose_name='Consultants and contractors'),
),
migrations.AddField(
model_name='casestudy',
name='energy_details',
field=models.CharField(blank=True, help_text='Please give more information about the transmission, network or storage technology.', max_length=200, verbose_name='Further details'),
),
migrations.AddField(
model_name='casestudy',
name='energy_transmission_capacity',
field=models.DecimalField(blank=True, decimal_places=3, max_digits=20, null=True, verbose_name='Total transmission capacity (kW)'),
),
migrations.AddField(
model_name='casestudy',
name='generation_type',
field=models.CharField(blank=True, choices=[('POW', 'Power'), ('HOT', 'Heat/Cool'), ('CHP', 'Combined Heat/Cool and Power (CHP)')], max_length=4, verbose_name='What is being generated?'),
),
migrations.AddField(
model_name='casestudy',
name='manufacturing_description',
field=models.TextField(blank=True, help_text='Briefly describe manufacturing process and components/outputs. (less than 500 characters, about 2 tweets).', max_length=500, verbose_name='Description'),
),
migrations.AddField(
model_name='casestudy',
name='manufacturing_factors',
field=multiselectfield.db.fields.MultiSelectField(blank=True, choices=[('LAND', 'Land use'), ('LABOR', 'Labor rights'), ('ENVIRO', 'Environmental factors'), ('LIFECYCLE', 'Lifecycle management'), ('OWN', 'Ownership'), ('OTHER', 'Other(s)')], max_length=128, verbose_name='Choose the factors that make this case remarkable, in a positive or negative way'),
),
migrations.AddField(
model_name='casestudy',
name='manufacturing_factors_description',
field=models.TextField(blank=True, verbose_name='Describe these factors'),
),
migrations.AddField(
model_name='casestudy',
name='manufacturing_ownership',
field=models.TextField(blank=True, verbose_name='Describe the ownership structure of the project and its relation with the local community'),
),
migrations.AddField(
model_name='casestudy',
name='manufacturing_related_tech',
field=multiselectfield.db.fields.MultiSelectField(blank=True, choices=[('PV', 'Solar PV'), ('CSP', 'CSP'), ('WIND', 'Wind power'), ('HYDRO', 'Hydropower'), ('GEO', 'Geothermal'), ('TRANSMIT', 'Electrical power transmission infrastructure'), ('STORE', 'Energy storage'), ('HEAT', 'Heat networks'), ('OTHER', 'Other'), ('IDK', 'Unknown')], max_length=128, verbose_name='What technology is this case related to?'),
),
migrations.AddField(
model_name='casestudy',
name='manufacturing_type',
field=models.CharField(blank=True, choices=[('GENERATE', 'Manufacturing of renewable energy generation equipment'), ('TRANSSTORE', 'Manufacturing of energy transmission or storage equipment'), ('RECYCLE', 'Recycling / reusing equipment or raw materials'), ('DISPOSAL', 'Disposal of equipment'), ('OTHER', 'Other')], max_length=16, verbose_name='Which of the following options best describes this case?'),
),
migrations.AlterField(
model_name='casestudy',
name='additional_technical_details',
field=models.TextField(blank=True, help_text='Add any additional details such as: length, from-to, voltage, substations, power output, (dis)charge rates, how this technology or project interacts with the energy system (e.g. provides reactive power to ensure power supply in phase etc.)', verbose_name='Additional technical or economic details'),
),
migrations.AlterField(
model_name='casestudy',
name='biomass_detail',
field=models.CharField(blank=True, help_text="<div class='text-muted'> <p>Please describe the source of the fuel and how it is processed/used. Please consider: <ul> <li>where the fuel came from e.g. corn, forestry, algae, commercial food waste, landfill gas, sewage, livestock farm, etc. <li>how it is processed e.g. direct-fired, co-firing with other renewable input, gasification, bacterial decomposition (anaerobic digestion, AD), pyrolysis, small/modular, artificial photosynthesis, fuel cell, etc. </ul> <p>We do not expect users to know this information, but if you do it may be useful to give a fuller picture. </div>", max_length=200, verbose_name='Bio-energy feedstock'),
),
migrations.AlterField(
model_name='casestudy',
name='completion_year',
field=models.IntegerField(blank=True, choices=[(1978, 1978), (1979, 1979), (1980, 1980), (1981, 1981), (1982, 1982), (1983, 1983), (1984, 1984), (1985, 1985), (1986, 1986), (1987, 1987), (1988, 1988), (1989, 1989), (1990, 1990), (1991, 1991), (1992, 1992), (1993, 1993), (1994, 1994), (1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023), (2024, 2024), (2025, 2025), (2026, 2026), (2027, 2027), (2028, 2028), (2029, 2029), (2030, 2030), (2031, 2031), (2032, 2032), (2033, 2033), (2034, 2034), (2035, 2035), (2036, 2036), (2037, 2037), (2038, 2038), (2039, 2039), (2040, 2040), (2041, 2041), (2042, 2042), (2043, 2043), (2044, 2044), (2045, 2045), (2046, 2046), (2047, 2047), (2048, 2048), (2049, 2049), (2050, 2050), (2051, 2051), (2052, 2052), (2053, 2053), (2054, 2054), (2055, 2055), (2056, 2056), (2057, 2057), (2058, 2058)], default=None, 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.", null=True, verbose_name='Operation start year'),
),
migrations.AlterField(
model_name='casestudy',
name='contractor_or_supplier_of_technology',
field=models.TextField(blank=True, help_text='List companies that act as contractors or suppliers \xa0e.g. Siemens Gamesa, GE, Alstom, Vestas, Hanwha Q CELLS, Mitsubishi, First Solar, Jinko Solar, Trina Solar, Suzlon Energy, Statkraft, Shanghai Electric, Ballard Power Systems, Panasonic, etc', verbose_name='Contractor and/or supplier of technology'),
),
migrations.AlterField(
model_name='casestudy',
name='coordinate_reference_system',
field=models.ForeignKey(blank=True, default=4326, null=True, on_delete=django.db.models.deletion.PROTECT, to='map.SpatialRefSys'),
),
migrations.AlterField(
model_name='casestudy',
name='describe_ecosystem',
field=models.TextField(verbose_name='Describe the ecosystem'),
),
migrations.AlterField(
model_name='casestudy',
name='direct_comms',
field=models.TextField(blank=True, help_text="Add any reports of direct communication between community members and representatives of developers/companies/investors. If you have files to upload, you can do this in 'other documents' on the 'uploads' tab.", verbose_name='Reports of direct communications'),
),
migrations.AlterField(
model_name='casestudy',
name='energy_customers',
field=models.TextField(blank=True, 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.", verbose_name='Energy service consumers/off-takers'),
),
migrations.AlterField(
model_name='casestudy',
name='energy_storage_capacity',
field=models.DecimalField(blank=True, decimal_places=3, max_digits=20, null=True, verbose_name='Total storage capacity (kWh)'),
),
migrations.AlterField(
model_name='casestudy',
name='entry_name',
field=models.CharField(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, verbose_name='Entry Name'),
),
migrations.AlterField(
model_name='casestudy',
name='financial_institutions',
field=multiselectfield.db.fields.MultiSelectField(blank=True, choices=[('AfDB', 'African Development Bank (AfDB)'), ('BADEA', 'Arab Bank for Economic Development in Africa (BADEA)'), ('ADB', 'Asian Development Bank (ADB)'), ('AIIB', 'Asian Infrastructure Investment Bank (AIIB)'), ('BSTDB', 'Black Sea Trade and Development Bank (BSTDB)'), ('CAF', 'Corporacion Andina de Fomento / Development Bank of Latin America (CAF)'), ('CDB', 'Caribbean Development Bank (CDB)'), ('CABEI', 'Central American Bank for Economic Integration (CABEI)'), ('EADB', 'East African Development Bank (EADB)'), ('ETDB', 'Economic Cooperation Organization Trade and Development Bank (ETDB)'), ('EDB', 'Eurasian Development Bank (EDB)'), ('EBRD', 'European Bank for Reconstruction and Development (EBRD)'), ('EC', 'European Commission (EC)'), ('EIB', 'European Investment Bank (EIB)'), ('IADB', 'Inter-American Development Bank Group (IDB, IADB)'), ('IFFIm', 'International Finance Facility for Immunisation (IFFIm)'), ('IFAD', 'International Fund for Agricultural Development (IFAD)'), ('IIB', 'International Investment Bank (IIB)'), ('IsDB', 'Islamic Development Bank (IsDB)'), ('FMO', 'Nederlandse Financieringsmaatschappij voor Ontwikkelingslanden NV (FMO)'), ('NDB', 'New Development Bank (NDB) (formerly BRICS Development Bank)'), ('NDF', 'The Nordic Development Fund'), ('NIB', 'Nordic Investment Bank (NIB)'), ('OFID', 'OPEC Fund for International Development (OFID)'), ('BOAD', 'West African Development Bank (BOAD)'), ('WB', 'World Bank')], help_text='Select any financial institutions (public or private) that have, or are considering, extending loans or guarantees to the project.', max_length=119, verbose_name='Financial institutions'),
),
migrations.AlterField(
model_name='casestudy',
name='full_description',
field=models.TextField(help_text='Describe the project in full. Separate paragraphs with two new lines. Please add as much detail as you feel is necessary here.', verbose_name='Full Description'),
),
migrations.AlterField(
model_name='casestudy',
name='generation_equipment_supplier',
field=models.TextField(blank=True, help_text='Enter the supplier of the generation equipment. (E.g. Siemens Gamesa, GE, Alstom, Vestas, Hanwha Q CELLS, Mitsubishi, First Solar, Jinko Solar, Trina Solar, Suzlon Energy, Statkraft, Shanghai Electric, Ballard Power Systems, Panasonic, etc.)', verbose_name='Generation equipment supplier(s)'),
),
migrations.AlterField(
model_name='casestudy',
name='generation_technology',
field=models.CharField(blank=True, choices=[('BIO', 'Bio-energy'), ('GEOT', 'Geothermal electricity'), ('Hydro', (('uHYD', 'Micro hydro (<100kW)'), ('SHYD', 'Small-scale hydro (<1MW)'), ('MHYD', 'Medium-scale hydro (1-30MW)'), ('LHYD', 'Large-scale hydro (>30MW - often not considered renewable)'))), ('Marine', (('WAVE', 'Wave'), ('TSTR', 'Tidal stream'), ('TBAR', 'Tidal barrage/lagoon'), ('TOTH', 'Other'))), ('Solar', (('SSPV', 'Small-scale photovoltaic (<500kW)'), ('LSPV', 'Large-scale photovoltaic (>500kW)'), ('CSP', 'Concentrated solar power (CSP)'), ('PARA', 'Parabolic trough (open or enclosed)'), ('FRES', 'Fresnel reflector'), ('STIR', 'Dish Stirling'))), ('Wind', (('SSWE', 'Small-scale wind (<500kW)'), ('LSWE', 'Large-scale wind (>500kW)'))), ('OTHR', 'Other (tidal, wave etc)')], help_text='Select the type of renewable energy generation that most applies to this case study.', max_length=4, verbose_name='Generation technology'),
),
migrations.AlterField(
model_name='casestudy',
name='identified_partnerships',
field=models.CharField(blank=True, help_text='Are you, or the organizing process that you represent, looking for partnerships, or have any clearly identified need? If so, please describe and we will try to connect you to appropriate partners.', max_length=256, verbose_name='Identified partnerships'),
),
migrations.AlterField(
model_name='casestudy',
name='isolated_or_widespread',
field=models.TextField(blank=True, help_text='Is this an isolated project or are there similar projects in the same geographic area? If so, can you describe them? Is there an analysis of cumulative or synergetic effects?', verbose_name='Is the project part of developments which are causing a cumulative effect?'),
),
migrations.AlterField(
model_name='casestudy',
name='land_ownership',
field=models.CharField(choices=[('PRI', 'Private land'), ('PUB', 'Public/state land'), ('COM', 'Community/communal/customary land'), ('CON', 'Contested/in conflict'), ('OTH', 'Other')], help_text='What type of ownership does the land fall under?', max_length=3, verbose_name='Land ownership / tenure'),
),
migrations.AlterField(
model_name='casestudy',
name='land_ownership_details',
field=models.TextField(blank=True, 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, verbose_name='Land ownership details'),
),
migrations.AlterField(
model_name='casestudy',
name='location_context',
field=models.CharField(choices=[('RUR', 'Rural'), ('URB', 'Urban'), ('MIX', 'Mixed')], help_text='Select the context that is most applicable to this case study.', max_length=3, verbose_name='Location'),
),
migrations.AlterField(
model_name='casestudy',
name='minerals_or_commodities',
field=models.CharField(blank=True, choices=[('ALU', 'Aluminium (Bauxite)'), ('ARS', 'Arsenic'), ('BER', 'Beryllium'), ('CAD', 'Cadmium'), ('CHR', 'Chromium'), ('COK', 'Coking'), ('COA', 'Coal (for steel)'), ('COP', 'Copper'), ('GAL', 'Gallium'), ('GER', 'Germanium'), ('GLD', 'Gold'), ('HRE', 'Heavy Rare Earth Elements (Gadolinium, Terbium, Dysprosium, Holmium, Erbium, Thulium, Ytterbium, Lutetium, Yttrium, Scandium)'), ('IRN', 'Iron'), ('LRE', 'Light Rare Earth Elements (Lanthanum, Cerium, Praseodymium, Neodymium, Promethium, Samarium, Europium)'), ('LED', 'Lead'), ('LIT', 'Lithium'), ('MAN', 'Manganese'), ('MER', 'Mercury'), ('MOL', 'Molybdenum'), ('NIC', 'Nickel'), ('NIO', 'Niobium'), ('PGM', 'Platinum group metals (ruthenium, rhodium, palladium, osmium, iridium, and platinum)'), ('RHE', 'Rhenium'), ('SIL', 'Silicon'), ('SIV', 'Silver'), ('TAN', 'Tantalum'), ('TEL', 'Tellurium'), ('THA', 'Thallium'), ('TIN', 'Tin'), ('TIT', 'Titanium'), ('TUN', 'Tungsten'), ('VAN', 'Vanadium'), ('ZNC', 'Zinc'), ('OTR', 'Other')], help_text='What mineral commodity is primarily mined in this project?', max_length=3, verbose_name='Primary mineral mined'),
),
migrations.AlterField(
model_name='casestudy',
name='minerals_or_commodities_other',
field=models.TextField(blank=True, help_text='Enter any mineral commodities not in the list. Separate each with a new line.', verbose_name='Other mineral commodities'),
),
migrations.AlterField(
model_name='casestudy',
name='negative_case_reasons',
field=multiselectfield.db.fields.MultiSelectField(blank=True, choices=[('VOLR', 'Violation of land rights'), ('VOHR', 'Violation of fundamental human rights, indigenous rights and/or other collective rights'), ('EIMP', 'Environmental impacts (severe impacts on ecosystems / violation of laws, plans or programs of environmental conservation or territorial governance systems etc.'), ('NCUL', 'Negative cultural impacts (erosion/destruction of bio-cultural heritage, impacts on sacred land etc)'), ('AGGR', 'Aggression/threats to community members opposed to the project, collaboration with organized crime etc'), ('ALAB', 'Abusive labour practices'), ('CRUP', 'Corruption and/or irregular permitting or contracting, conflicts of interest etc')], max_length=34, verbose_name='What kind of case is this entry about?'),
),
migrations.AlterField(
model_name='casestudy',
name='negative_socioenvironmental_impacts',
field=models.TextField(blank=True, help_text='Provide a detailed description of the socio-environmental impacts (please provide all relevant details, such as type of ecosystem and presence of any existing reserve in the area, land to have increased biodiversity as a result of the project, new protection of lands/waters, specific communities affected by the project, total geographic footprint of the project, and tenure system affected in the case of land grabs, kind of permits that were irregularly issued if this is the case.', verbose_name='Describe the socio-environmental impacts (positive and negative):'),
),
migrations.AlterField(
model_name='casestudy',
name='obstacles_and_hindrances',
field=models.TextField(blank=True, help_text='Please describe the status of the organizing process, including the obstacles and hindrances faced.', max_length=512, verbose_name='Current status of the organizing process around this case'),
),
migrations.AlterField(
model_name='casestudy',
name='official_project_documents',
field=models.ManyToManyField(blank=True, help_text='Attach any legal or official documents that relate to the project. Hold down Control, or Command on a Mac, to select more than one.', related_name='official_project_document_for', to='files.File', verbose_name='Official project documents'),
),
migrations.AlterField(
model_name='casestudy',
name='other_documents',
field=models.ManyToManyField(blank=True, help_text='Attach any other documents that relate to the project. Hold down Control, or Command on a Mac, to select more than one.', related_name='other_document_for', to='files.File', verbose_name='Other documents'),
),
migrations.AlterField(
model_name='casestudy',
name='people_affected_other',
field=models.TextField(blank=True, help_text='Please describe further the communities or identities present in the project area.', verbose_name='Communities or identities further detail'),
),
migrations.AlterField(
model_name='casestudy',
name='positive_case_type',
field=multiselectfield.db.fields.MultiSelectField(blank=True, choices=[('CREP', 'Community project (co-)owned by individuals'), ('EACP', 'Community project owned by not-for-profit organizations and/or serving the public interest'), ('PSEP', 'Public/state (federal, state, municipal) project'), ('CORS', 'Reuse / Recycling / Circular economy project')], max_length=32, verbose_name='What kind of case is this entry about?'),
),
migrations.AlterField(
model_name='casestudy',
name='positive_or_negative',
field=models.CharField(choices=[('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')], max_length=1, verbose_name='What is the relationship of local community organization(s) to this project?'),
),
migrations.AlterField(
model_name='casestudy',
name='power_technology',
field=models.CharField(blank=True, choices=[('PT', 'Electrical power transmission'), ('HN', 'Heat networks'), ('OT', 'Other')], max_length=2, verbose_name='Power technology'),
),
migrations.AlterField(
model_name='casestudy',
name='power_technology_other',
field=models.CharField(blank=True, max_length=128, verbose_name='Further information about power technology'),
),
migrations.AlterField(
model_name='casestudy',
name='project_owners',
field=models.TextField(blank=True, help_text='List companies or organisations that own the project and/or facilities. Provide company numbers etc. if available. Separate with a new line.', verbose_name='Project and facility owners'),
),
migrations.AlterField(
model_name='casestudy',
name='project_status',
field=models.CharField(choices=[('INIT', 'Initiation/ideation'), ('PROJCD', 'In planning and design'), ('FAIL', 'Failed'), ('UCONST', 'Under construction'), ('EXSTNG', 'In operation'), ('DECOMM', 'Undergoing decommissioning'), ('END', 'Decommissioned')], max_length=6, verbose_name='Status of project'),
),
migrations.AlterField(
model_name='casestudy',
name='project_status_detail',
field=models.TextField(blank=True, help_text='Describe the current situation and likely future scenarios.', verbose_name='Current status of the case'),
),
migrations.AlterField(
model_name='casestudy',
name='projected_production_of_commodities',
field=models.CharField(blank=True, help_text='Describe the projected production of commodities per annum and overall.<br> For example, "40 million tonnes of iron ore per year", "200 million tonnes over 5 year life of mine"', max_length=256, verbose_name='Estimated production of key commodities'),
),
migrations.AlterField(
model_name='casestudy',
name='sector_of_economy',
field=models.CharField(choices=[('RN', 'Renewable energy generation project'), ('PG', 'Energy networks'), ('ST', 'Energy storage facilities'), ('SM', 'Mining related to the renewable energy economy'), ('MA', 'Manufacturing and/or processing of equipment')], max_length=3, verbose_name='Sector of economy'),
),
migrations.AlterField(
model_name='casestudy',
name='shapefiles',
field=models.ManyToManyField(blank=True, help_text='If you have territory that you would like to show in relation to this project - e.g. Bienes Comunales de Ixtepec etc. This is a set of 3 or more (often 5-6) files with file extensions like .cpg, .dbf, .prj, .qpj, .shp, .shx. Hold down Control, or Command on a Mac, to select more than one. Let us know (database@ojuso.org) if you have other file types or need help and we can work out how to import it. You may have data as GeoPackage (gpkg), GeoJSON, KML, GML, etc. or have data in PostGIS or another spatial database management system already.', related_name='shapefile_for', to='files.File', verbose_name='Geographic data'),
),
migrations.AlterField(
model_name='casestudy',
name='size_of_concessions',
field=models.CharField(blank=True, help_text="Describe the size of concession(s) granted to company/companies (e.g. 'one concession of 2,300 hectares')", max_length=200, verbose_name='Size of concessions (land/marine area)'),
),
migrations.AlterField(
model_name='casestudy',
name='socioeconomic_benefits',
field=models.TextField(blank=True, verbose_name='Socio-economic impacts'),
),
migrations.AlterField(
model_name='casestudy',
name='start_year',
field=models.IntegerField(blank=True, choices=[(1978, 1978), (1979, 1979), (1980, 1980), (1981, 1981), (1982, 1982), (1983, 1983), (1984, 1984), (1985, 1985), (1986, 1986), (1987, 1987), (1988, 1988), (1989, 1989), (1990, 1990), (1991, 1991), (1992, 1992), (1993, 1993), (1994, 1994), (1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023), (2024, 2024), (2025, 2025), (2026, 2026), (2027, 2027), (2028, 2028), (2029, 2029), (2030, 2030), (2031, 2031), (2032, 2032), (2033, 2033), (2034, 2034), (2035, 2035), (2036, 2036), (2037, 2037), (2038, 2038), (2039, 2039), (2040, 2040), (2041, 2041), (2042, 2042), (2043, 2043), (2044, 2044), (2045, 2045), (2046, 2046), (2047, 2047), (2048, 2048), (2049, 2049), (2050, 2050), (2051, 2051), (2052, 2052), (2053, 2053), (2054, 2054), (2055, 2055), (2056, 2056), (2057, 2057), (2058, 2058)], 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.', null=True, verbose_name='Construction start year'),
),
migrations.AlterField(
model_name='casestudy',
name='total_investment',
field=models.IntegerField(blank=True, help_text='The approximate total investment for the project in US dollars.', null=True, verbose_name='Total investment (in USD)'),
),
migrations.AlterField(
model_name='casestudy',
name='type_of_ecosystem',
field=multiselectfield.db.fields.MultiSelectField(blank=True, choices=[('MARINE', 'Marine (e.g. Ocean, Sea)'), ('FRESH', 'Freshwater (e.g. Freshwater, Lake)'), ('FOREST', 'Forest/Jungle'), ('AGRI', 'Agricultural Land'), ('GRASS', 'Grassland'), ('DESERT', 'Desert (Tundra, Ice or Sand)'), ('WETLND', 'Wetland (Marsh, Mangrove, Peat Soil)'), ('URBAN', 'Urban')], max_length=56, verbose_name='Type(s) of ecosystem'),
),
migrations.AlterField(
model_name='casestudy',
name='use_in_energy_economy',
field=multiselectfield.db.fields.MultiSelectField(blank=True, choices=[('CPV', 'Concentrated solar power (CSP)'), ('EPT', 'Electrical power transmission infrastructure'), ('ESS', 'Energy storage'), ('GGM', 'Geothermal'), ('HGM', 'Hydropower'), ('HNT', 'Heat networks'), ('SPM', 'Solar PV'), ('STM', 'Solar thermal systems'), ('WTM', 'Wind power'), ('ESS', "Don't know"), ('OTR', 'Other')], max_length=128, verbose_name='Potential use in renewable energy economy'),
),
migrations.AlterField(
model_name='casestudy',
name='use_in_energy_economy_other',
field=models.CharField(blank=True, max_length=128, verbose_name='Other'),
),
migrations.AlterField(
model_name='casestudy',
name='when_did_organising_start',
field=models.CharField(blank=True, help_text='Before the project started? During project implementation? After project implementation? Describe in your own words.', max_length=512, verbose_name='When did local organising efforts begin?'),
),
migrations.AlterField(
model_name='pointofinterest',
name='slug',
field=django_extensions.db.fields.AutoSlugField(blank=True, editable=False, populate_from=['title']),
),
]

File diff suppressed because it is too large Load Diff

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 }}
{% endif %}
<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,55 +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.maximum_power_output %}
<dt>{% trans "Maximum power output" %}:
<dd id="maximum_power_output">
{{ case_study.maximum_power_output | intcomma }} W
{% if case_study.energy_transmission_capacity %}
<dt>{% trans "Energy transmission capacity" %}:
<dd id="energy_transmission_capacity">
{{ case_study.energy_transmission_capacity }} kW
{% endif %}
{% if case_study.discharge_time %}
<dt>{% trans "Time for discharge from full capacity" %}:
<dd id="discharge_time">
{{ case_study.discharge_time | intcomma }} {% trans "seconds" %}
{% 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.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 }}
{% 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 %}
@ -330,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 %}
@ -369,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 %}
@ -387,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 }}
{% endif %}
{% if case_study.positive_case_type %}
{% 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">
@ -417,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">
@ -476,13 +507,17 @@ 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 %}
{% endif %}
{% if case_study.identified_partnerships %}
<dt>{% trans "Identified partnerships" %}:
<dd id="identified_partnerships">
{{ case_study.identified_partnerships }}
{% endif %}
</dl>

View File

@ -4,9 +4,14 @@
{% block stylesheets %}
{{ block.super }}
{% leaflet_css %}
<style>
.page-lead { border-left: 10px solid #4ac95d; }
</style>
{% endblock %}
{% block page_title %}{% trans "Submit a Case Study" %} - {{ block.super }}{% endblock %}
{% block page_title %}{% trans "New Case Study" %} - {{ block.super }}{% endblock %}
{% block title %}{% trans "New Case Study" %}{% endblock %}
{% block description %}{% trans "Here you can submit a case study for review and it will be added to the map." %}{% endblock %}
{% block inner %}
@ -40,158 +45,195 @@
<!-- Conditional logic for hiding and un-hiding fields. -->
<script>
// Here we define the fields we need to conditionally toggle.
// TODO: Move this knowledge out of the template
var conditionalFields = [
{
"field": "#id_location_context",
"showHide": ["#div_id_type_of_ecosystem"],
"condition": ["RUR"]
},
{
"field": "#id_power_technology",
"showHide": ["#div_id_power_technology_other"],
"condition": ["OT"]
},
{ // 2.1 - Power Generation
"field": "#id_sector_of_economy",
"showHide": ["#power_generation_questions"],
"condition": ["RN"]
},
{
"field": "#id_generation_technology",
"showHide": ["#div_id_biomass_detail"],
"condition": ["BIOG", "OTHB"]
},
{
"field": "#id_generation_technology",
"showHide": ["#div_id_generation_technology_other"],
"condition": ["OTHR"]
},
{ // 2.2 - Power Grids
"field": "#id_sector_of_economy",
"showHide": ["#power_grids_energy_storage_questions"],
"condition": ["PG"]
},
{ // 2.3 - Supply of minerals
"field": "#id_sector_of_economy",
"showHide": ["#mineral_commodity_questions"],
"condition": ["SM"]
},
{ // 3.1
"field": "#id_positive_or_negative",
"showHide": ["#positive_case_questions"],
"condition": ["P"]
},
{ // 3.2
"field": "#id_positive_or_negative",
"showHide": ["#negative_case_questions"],
"condition": ["N"]
}];
// Here we define the checkboxes that we need to use to
// conditionally toggle fields - they use slightly different
// logic as they rely on the 'checked' attribute rather than value.
var conditionalCheckboxes = [
{
"checkbox": "#id_affects_indigenous",
"showHide": "#div_id_affects_indigenous_detail"
},
{
"checkbox": "#id_shown_on_other_platforms",
"showHide": "#div_id_shown_on_other_platforms_detail"
},
{
"checkbox": "#id_negative_case_reasons_8",
"showHide": "#div_id_negative_case_reasons_other"
//
// Helper functions for conditional field show/hide
//
// Show or hide an element, or selection of elements, depending shouldShow
function showIf(thingToShow, shouldShow) {
if (shouldShow) {
$(thingToShow).show()
} else {
$(thingToShow).hide()
}
];
}
// Define a function that hides the field and then creates a listener to toggle the field.
// Takes a single conditionalField dictionary with (field, showHide and condition).
function addConditionalField(item) {
hideAll(item.showHide);
$(item.field).change(function(){
// Get the value of the option
var value = $(this).val();
// Constructor function to make list below more terse
function show(condition, selector) {
return { showHide: selector, visible: condition }
}
// Check the value matches any of the conditions.
if (isInArray(value, item.condition)){
showAll(item.showHide);
} else {
hideAll(item.showHide);
// Returns true if checkbox is checked
function isChecked(elem) {
return elem.checked
}
// Returns a function that returns true if its parameter matches `condition`
function isEqual(condition) {
return elem => elem.value === condition
}
// Inverse of the above
function isNot(condition) {
return elem => elem.value !== condition
}
// Returns a function that returns true if its parameter is in `conditions`
function isOneOf(conditions) {
return elem => conditions.includes(elem.value)
}
//
// The big ol' list of controls and what sections they toggle the display of
// TODO: Move this knowledge out of the template
//
var showHideFields = {
// 'Basic information' tab
'location_context': [
show(isEqual('RUR'), '#div_id_type_of_ecosystem'), // Rural
],
// Technical/economic tab
'sector_of_economy': [
show(isEqual('RN'), '.power_generation_questions'), // Energy generation project
show(isEqual('PG'), '.energy_network_questions'), // Energy networks (PG = power grid)
show(isEqual('ST'), '.energy_storage_questions'), // Storage
show(isOneOf(['RN', 'ST', 'PG']),
'.energy_generation_network_and_storage_questions'),
show(isEqual('SM'), '.mineral_commodity_questions'), // Mining
show(isEqual('MA'), '.manufacturing_questions'), // Manufacturing
],
'use_in_energy_economy': [
show(isEqual('OTR'), '#div_id_use_in_energy_economy_other'),
],
'power_technology': [
show(isEqual('OT'), '#div_id_power_technology_other'),
],
'generation_technology': [
show(isEqual('BIO'), '#div_id_biomass_detail'), // Bio-energy
],
// Socio-environmental tab
'positive_or_negative': [
show(isNot('N'), '#div_id_positive_case_type'),
show(isNot('P'), '#div_id_negative_case_reasons'),
show(isOneOf([ 'P', 'N' ]), '#div_id_obstacles_and_hindrances'),
],
'negative_case_reasons': [
show(isEqual('OTHR'), '#div_id_negative_case_reasons_other'),
],
// Contact tab
'shown_on_other_platforms': [
show(isChecked, '#div_id_shown_on_other_platforms_detail'),
],
};
//
// Fields that require their own more advanced logic
//
var conditionalControls = [
{
name: 'sector_of_economy',
redraw: function() {
const sector = document.forms['case-study-form'].sector_of_economy
const input = document.querySelector(`[name=positive_case_type][value=CORS]`)
// If sector of economy is transmission, mining, or processing
// Then enable this input. Otherwise, disable.
// TODO: Could make the row invisible
input.disabled = ['PG', 'SM', 'MA'].includes(sector.value) ? false : true
}
});
}
},
// This function does the same as addConditionalField except it checks the status of
// checkboxes instead of fields.
function addConditionalCheckbox(item) {
$(item.showHide).hide();
$(item.checkbox).change(function(){
if ($(this).is(":checked")) {
$(item.showHide).show();
} else {
$(item.showHide).hide();
{
name: 'positive_or_negative',
redraw: function() {
const setting = document.forms['case-study-form'].positive_or_negative
//
// This is some nasty hacking around wanting different field labels/
// help texts depending on the positive_or_negative option.
//
// Each piece of text whose display is dependent on what option is selected
// has the class 'organising', plus at least one of 'organising-vs/pro/none/idk'.
//
// The base `organising` class sets display: none. Then, we go through
// all the elements tagged with the current choice, reset element-specific
// display styling, and then apply `display: inline` just to the desired
// elements.
//
const relatedElements = [
{ value: 'P', elements: '.organising-pro' },
{ value: 'N', elements: '.organising-vs' },
{ value: 'X', elements: '.organising-none' },
{ value: 'U', elements: '.organising-idk' },
{ value: '', elements: '.organising-idk' },
]
let show = null
for (const { value, elements } of relatedElements) {
if (value === setting.value) {
show = elements
}
$(elements).css("display", "")
}
$(show).css("display", "inline")
}
});
}
},
]
// Helper functions
function show(tag) {
$(tag).show();
}
function hide(tag) {
$(tag).hide();
}
function showAll(tags) {
tags.forEach(show);
}
function hideAll(tags) {
tags.forEach(hide);
}
function isInArray(value, array) {
return array.indexOf(value) > -1;
}
$(document).ready(function(){
$(function() {
// Button classes for tab navigation
$('.btnNext').click(function(){
$('.btnNext').click(function() {
$('.nav-tabs > .active').next('li').find('a').trigger('click');
});
$('.btnPrevious').click(function(){
$('.btnPrevious').click(function() {
$('.nav-tabs > .active').prev('li').find('a').trigger('click');
});
$('form').attr('novalidate', 'novalidate');
conditionalFields.forEach(addConditionalField);
conditionalCheckboxes.forEach(addConditionalCheckbox);
// Add conditional form show/hide logic
for (const field of Object.keys(showHideFields)) {
const control = document.forms['case-study-form'][field]
conditionalFields.forEach(function(item){
$(item.field).change();
});
$(control).change(() => {
conditionalCheckboxes.forEach(function(item){
$(item.checkbox).change();
});
});
for (const row of showHideFields[field]) {
// Check the value matches any of the conditions.
showIf(row.showHide, row.visible(control))
}
});
</script>
<script>
$(function() {
initDrafts()
$(control).change();
}
// Jump to error
if ($('.has-error').length) {
location.href = '#' + $('.has-error:first').attr('id');
}
})
// Add handlers for more advanced form logic
for (const group of conditionalControls) {
$(`[name=${group.name}]`).on('change', group.redraw)
group.redraw();
}
initDrafts()
// Jump to error
if ($('.has-error').length) {
location.href = '#' + $('.has-error:first').attr('id');
}
})
</script>
{% endblock %}

View File

@ -80,6 +80,8 @@
</div>
</a>
<p style="margin-top: 40px">If you are interested in writing a technology assessment or policy analysis to appear on this site, please email <a href="mailto:info@ojuso.org">info@ojuso.org</a>.</p>
</div>
</div>

View File

@ -83,38 +83,10 @@ class CaseStudyDraftAPITests(TestCase):
class CaseStudyTests(TestCase):
def test_get_renewable_generation_detail_when_empty(self):
"""get_renewable_generation_detail() should return the empty string."""
def test_youtube(self):
case_study = CaseStudy()
self.assertIs(case_study.get_renewable_generation_detail(), "")
case_study.video = "https://www.youtube.com/watch?v=h2V4-UP7ML0"
self.assertIs(case_study.is_video_youtube(), True)
def test_get_renewable_generation_detail_with_geo(self):
"""get_renewable_generation_detail() should return just the description"""
case_study = CaseStudy(generation_technology='GEOT')
self.assertEqual(case_study.get_renewable_generation_detail(), "Geothermal electricity")
def test_get_renewable_generation_detail_with_wind(self):
"""get_renewable_generation_detail() should return the description prefixed with 'wind power'"""
case_study = CaseStudy(generation_technology='SSWE')
self.assertTrue(case_study.get_renewable_generation_detail().startswith("Wind energy"))
def test_get_renewable_generation_detail_with_other(self):
"""get_renewable_generation_detail() should return the detail provided in .generation_technology_other"""
case_study = CaseStudy(generation_technology='OTHR', generation_technology_other='Warp drive')
self.assertEqual(case_study.get_renewable_generation_detail(), "Warp drive")
def test_get_negative_case_reasons_no_other_1(self):
"""Test with case having no 'other' entry"""
case_study = CaseStudy(negative_case_reasons=['VOLR','ALAB'])
self.assertEqual(case_study.get_negative_case_reasons_no_other(),
[ 'Violation of land rights'
, 'Abusive labour practices'
])
def test_get_negative_case_reasons_no_other_2(self):
"""Test with case having an 'other' entry"""
case_study = CaseStudy(negative_case_reasons=['VOLR','ALAB','OTHR'])
self.assertEqual(case_study.get_negative_case_reasons_no_other(),
[ 'Violation of land rights'
, 'Abusive labour practices'
])
# case_study.video = "https://youtu.be/h2V4-UP7ML0"
# self.assertIs(case_study.is_video_youtube(), True)

View File

@ -75,18 +75,18 @@ class BaseForm(LoginRequiredMixin, CreateView):
self.object = form.save()
self.object.official_project_documents = form.cleaned_data.get(
self.object.official_project_documents.set(form.cleaned_data.get(
'official_project_documents_files', []
)
self.object.other_documents = form.cleaned_data.get(
))
self.object.other_documents.set(form.cleaned_data.get(
'other_documents_files', []
)
self.object.shapefiles = form.cleaned_data.get(
))
self.object.shapefiles.set(form.cleaned_data.get(
'shapefiles_files', []
)
self.object.images = form.cleaned_data.get(
))
self.object.images.set(form.cleaned_data.get(
'images_files', []
)
))
self.object.author = self.request.user
self.object.save()

View File

@ -1,3 +1,7 @@
h1 {
font-weight: bold;
}
/* Make sure that the footer doesn't have space after it */
.container { min-height: 60vh; }
@ -146,6 +150,12 @@
}
/* socio-environmental analysis tab styles */
.organising {
display: none;
}
/*
* HOME PAGE
*/

View File

@ -5,8 +5,8 @@
{{ block.super }}
<style>
.page-lead {
padding: 40px 15px;
text-align: center;
padding: 5px 30px;
margin-bottom: 20px;
}
</style>
{% endblock %}
@ -16,8 +16,8 @@
<div class="container">
<div class="page-lead">
<h1 class="text-center">{% block title %}{% endblock %}</h1>
<p class="lead text-center">{% block description %}{% endblock %}</p>
<h1>{% block title %}{% endblock %}</h1>
<p class="lead">{% block description %}{% endblock %}</p>
</div>
{% block inner %}

View File

@ -119,14 +119,14 @@ class MapTest(SeleniumTest):
self.sl.find_element_by_id('id_entry_name').send_keys('Short Entry');
Select(self.sl.find_element_by_id('id_country')).select_by_visible_text('Albania');
self.sl.find_element_by_id('id_area_of_land').send_keys('123');
Select(self.sl.find_element_by_id('id_land_ownership')).select_by_visible_text('Private Land');
Select(self.sl.find_element_by_id('id_land_ownership')).select_by_visible_text('Private land');
Select(self.sl.find_element_by_id('id_location_context')).select_by_visible_text('Urban');
self.sl.find_element_by_id('id_describe_ecosystem').send_keys('test');
Select(self.sl.find_element_by_id('id_project_status')).select_by_visible_text('Existing Project');
Select(self.sl.find_element_by_id('id_sector_of_economy')).select_by_visible_text('Power Grids');
Select(self.sl.find_element_by_id('id_project_status')).select_by_visible_text('In planning and design');
self.sl.find_element_by_css_selector('[name=sector_of_economy][value=ST]').click()
self.sl.find_element_by_id('id_synopsis').send_keys('test');
self.sl.find_element_by_id('id_full_description').send_keys('test');
Select(self.sl.find_element_by_id('id_positive_or_negative')).select_by_visible_text('Positive');
Select(self.sl.find_element_by_id('id_positive_or_negative')).select_by_visible_text('There is/was an organising process in favour of the project');
# you can submit the form on any field. Using this one because the submit button sometimes isn't visible
self.sl.find_element_by_id('id_area_of_land').submit();
self.assertTrue("Thanks!" in self.sl.page_source, "Success message not shown")
@ -140,18 +140,18 @@ class MapTest(SeleniumTest):
self.sl.find_element_by_id('id_entry_name').send_keys('Long Entry');
Select(self.sl.find_element_by_id('id_country')).select_by_visible_text('Albania');
self.sl.find_element_by_id('id_area_of_land').send_keys('123');
Select(self.sl.find_element_by_id('id_land_ownership')).select_by_visible_text('Private Land');
Select(self.sl.find_element_by_id('id_land_ownership')).select_by_visible_text('Private land');
Select(self.sl.find_element_by_id('id_location_context')).select_by_visible_text('Urban');
self.sl.find_element_by_id('id_describe_ecosystem').send_keys('test');
Select(self.sl.find_element_by_id('id_project_status')).select_by_visible_text('Existing Project');
Select(self.sl.find_element_by_id('id_project_status')).select_by_visible_text('In planning and design');
self.sl.find_element_by_id('id_synopsis').send_keys('test');
self.sl.find_element_by_id('id_full_description').send_keys('test');
self.sl.find_element_by_id('id_project_owners').send_keys('test');
self.sl.find_element_by_id('id_shareholders').send_keys('test');
self.sl.find_element_by_css_selector('a[href="#technical-and-economic-analysis"]').click()
Select(self.sl.find_element_by_id('id_sector_of_economy')).select_by_visible_text('Power Grids');
self.sl.find_element_by_css_selector('[name=sector_of_economy][value=ST]').click()
self.sl.find_element_by_css_selector('a[href="#socio-environmental-analysis"]').click()
Select(self.sl.find_element_by_id('id_positive_or_negative')).select_by_visible_text('Positive');
Select(self.sl.find_element_by_id('id_positive_or_negative')).select_by_visible_text('There is/was an organising process in favour of the project');
self.sl.find_element_by_css_selector('a[href="#uploads"]').click()
# you can submit the form on any field. Using this one because the submit button sometimes isn't visible
self.sl.find_element_by_id('id_name_of_territory_or_area').submit();