2017-10-09 23:58:36 +00:00
|
|
|
from django.urls import reverse
|
2017-11-18 16:54:44 +00:00
|
|
|
from django import forms
|
|
|
|
from django.utils.translation import ugettext as _
|
2018-04-02 09:59:37 +00:00
|
|
|
from django.utils.safestring import mark_safe
|
2017-06-16 16:06:22 +00:00
|
|
|
from crispy_forms.helper import FormHelper
|
2018-03-28 07:16:52 +00:00
|
|
|
from crispy_forms.layout import Submit, Layout, HTML, Fieldset, Div
|
2017-11-18 16:54:44 +00:00
|
|
|
from crispy_forms.bootstrap import Tab, TabHolder, PrependedText, FormActions
|
2017-06-16 16:06:22 +00:00
|
|
|
from leaflet.forms.widgets import LeafletWidget
|
|
|
|
|
|
|
|
from .models import CaseStudy
|
|
|
|
|
|
|
|
|
2018-03-27 04:14:01 +00:00
|
|
|
class BaseCaseStudyForm(forms.models.ModelForm):
|
2017-10-09 23:58:36 +00:00
|
|
|
"""Base form class for the CaseStudy model."""
|
2017-06-16 16:06:22 +00:00
|
|
|
def __init__(self, *args, **kwargs):
|
2017-10-08 20:21:51 +00:00
|
|
|
super(BaseCaseStudyForm, self).__init__(*args, **kwargs)
|
2018-03-28 07:16:52 +00:00
|
|
|
self.helper = FormHelper(self)
|
2017-06-16 16:06:22 +00:00
|
|
|
self.helper.form_id = 'case-study-form'
|
|
|
|
self.helper.form_class = 'form-horizontal'
|
|
|
|
self.helper.form_method = 'post'
|
2017-10-08 20:21:51 +00:00
|
|
|
self.helper.form_action = 'add'
|
2017-06-16 16:06:22 +00:00
|
|
|
self.helper.label_class = 'col-lg-2'
|
|
|
|
self.helper.field_class = 'col-lg-8'
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = CaseStudy
|
|
|
|
fields = '__all__'
|
2017-11-18 16:54:44 +00:00
|
|
|
widgets = {
|
|
|
|
'location': LeafletWidget(attrs={}),
|
|
|
|
'official_project_documents': forms.ClearableFileInput(attrs={'multiple': True}),
|
|
|
|
'other_documents': forms.ClearableFileInput(attrs={'multiple': True}),
|
|
|
|
'shapefiles': forms.ClearableFileInput(attrs={'multiple': True}),
|
|
|
|
}
|
2017-10-08 20:21:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
class ShortCaseStudyForm(BaseCaseStudyForm):
|
2017-10-09 23:58:36 +00:00
|
|
|
"""Short version of the CaseStudy form."""
|
|
|
|
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
super(ShortCaseStudyForm, self).__init__(*args, **kwargs)
|
|
|
|
self.helper.form_action = reverse('short-form')
|
2018-03-28 07:16:52 +00:00
|
|
|
self.helper.add_input(Submit('submit', _('Submit'), css_class='btn-success center-block'))
|
2017-10-09 23:58:36 +00:00
|
|
|
|
2017-10-08 20:21:51 +00:00
|
|
|
class Meta(BaseCaseStudyForm.Meta):
|
|
|
|
fields = [
|
|
|
|
'entry_name',
|
|
|
|
'location',
|
|
|
|
'sector_of_economy',
|
|
|
|
'positive_or_negative',
|
|
|
|
'country',
|
|
|
|
'area_of_land',
|
|
|
|
'land_ownership',
|
|
|
|
'land_ownership_details',
|
|
|
|
'location_context',
|
|
|
|
'type_of_ecosystem',
|
|
|
|
'describe_ecosystem',
|
2018-03-31 11:38:06 +00:00
|
|
|
'people_affected_indigenous',
|
|
|
|
'people_affected_other',
|
2017-10-08 20:21:51 +00:00
|
|
|
'project_status',
|
|
|
|
'synopsis',
|
|
|
|
'full_description',
|
|
|
|
'image',
|
2017-10-31 14:57:26 +00:00
|
|
|
'image_caption',
|
|
|
|
'image_credit',
|
|
|
|
'video',
|
|
|
|
'media_coverage_mainstream',
|
|
|
|
'media_coverage_independent',
|
2017-10-08 20:21:51 +00:00
|
|
|
'community_voices'
|
|
|
|
]
|
|
|
|
|
2018-04-04 22:15:51 +00:00
|
|
|
|
2017-10-08 20:21:51 +00:00
|
|
|
class LongCaseStudyForm(BaseCaseStudyForm):
|
2017-10-09 23:58:36 +00:00
|
|
|
"""Long version of the CaseStudy form."""
|
2018-04-02 09:59:37 +00:00
|
|
|
|
|
|
|
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."),
|
|
|
|
}
|
|
|
|
|
2017-10-09 23:58:36 +00:00
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
super(LongCaseStudyForm, self).__init__(*args, **kwargs)
|
2018-04-02 09:59:37 +00:00
|
|
|
|
|
|
|
POSITIVE_CASE_TYPE_CHOICES = [
|
|
|
|
(choice[0], mark_safe('<b>%s</b><br><span class="text-muted">%s</span>' % (choice[1], self.POSITIVE_CASE_TYPE_HELP[choice[0]])))
|
|
|
|
for choice in CaseStudy.POSITIVE_CASE_TYPE_CHOICES
|
|
|
|
]
|
|
|
|
|
|
|
|
self.fields['positive_case_type'] = forms.ChoiceField(
|
|
|
|
widget=forms.RadioSelect(),
|
|
|
|
choices=POSITIVE_CASE_TYPE_CHOICES
|
|
|
|
)
|
|
|
|
|
2018-04-04 22:26:34 +00:00
|
|
|
self.fields['project_owners'].required = True
|
|
|
|
self.fields['shareholders'].required = True
|
|
|
|
|
2017-10-09 23:58:36 +00:00
|
|
|
self.helper.form_action = reverse('long-form')
|
2017-10-31 14:57:26 +00:00
|
|
|
self.helper.layout = Layout(
|
|
|
|
TabHolder(
|
2017-11-18 16:54:44 +00:00
|
|
|
Tab(_("Basic information"),
|
2017-10-31 14:57:26 +00:00
|
|
|
'entry_name',
|
|
|
|
'location',
|
|
|
|
'country',
|
|
|
|
'area_of_land',
|
|
|
|
'land_ownership',
|
|
|
|
'land_ownership_details',
|
|
|
|
'location_context',
|
|
|
|
'type_of_ecosystem',
|
|
|
|
'describe_ecosystem',
|
2018-03-31 11:38:06 +00:00
|
|
|
'people_affected_indigenous',
|
|
|
|
'people_affected_other',
|
2017-10-31 14:57:26 +00:00
|
|
|
'project_status',
|
|
|
|
'synopsis',
|
|
|
|
'full_description',
|
|
|
|
'image',
|
|
|
|
'image_caption',
|
|
|
|
'image_credit',
|
|
|
|
'video',
|
2017-11-18 16:54:44 +00:00
|
|
|
'video_caption',
|
|
|
|
'video_credit',
|
2018-03-31 09:59:42 +00:00
|
|
|
Fieldset(
|
|
|
|
_("Ownership and finance"),
|
|
|
|
'project_owners',
|
|
|
|
'shareholders',
|
|
|
|
'financial_institutions',
|
|
|
|
'financial_institutions_other',
|
|
|
|
'energy_customers'
|
|
|
|
),
|
|
|
|
Fieldset(
|
|
|
|
_("Media reports and other communications"),
|
|
|
|
'media_coverage_mainstream',
|
|
|
|
'media_coverage_independent',
|
|
|
|
'community_voices',
|
|
|
|
'direct_comms',
|
|
|
|
'social_media_links'
|
|
|
|
),
|
2017-11-18 16:54:44 +00:00
|
|
|
FormActions(
|
|
|
|
HTML("<a class='btn btn-primary btnNext pull-right'>"+_("Next")+"</a>")
|
|
|
|
)
|
|
|
|
),
|
2017-10-31 14:57:26 +00:00
|
|
|
Tab(
|
2017-11-18 16:54:44 +00:00
|
|
|
_("Technical and economic analysis"),
|
2018-03-31 09:59:42 +00:00
|
|
|
'sector_of_economy',
|
2017-11-18 16:54:44 +00:00
|
|
|
Fieldset(
|
|
|
|
_("Power Generation Questions"),
|
|
|
|
'generation_technology',
|
|
|
|
'biomass_detail',
|
|
|
|
'generation_technology_other',
|
|
|
|
'total_generation_capacity',
|
|
|
|
'generation_equipment_supplier',
|
|
|
|
'total_investment',
|
|
|
|
'technical_or_economic_details',
|
|
|
|
css_id="power_generation_questions"
|
|
|
|
),
|
|
|
|
Fieldset(
|
|
|
|
_("Power Grids/Energy Storage Questions"),
|
|
|
|
'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"
|
|
|
|
),
|
|
|
|
Fieldset(
|
|
|
|
_("Mineral/Commodity Questions"),
|
|
|
|
'minerals_or_commodities',
|
|
|
|
'minerals_or_commodities_other',
|
|
|
|
'use_in_energy_economy',
|
|
|
|
'use_in_energy_economy_other',
|
|
|
|
'project_life_span',
|
|
|
|
'size_of_concessions',
|
|
|
|
'projected_production_of_commodities',
|
|
|
|
'type_of_extraction',
|
|
|
|
'associated_infrastructure',
|
|
|
|
css_id="mineral_commodity_questions"
|
|
|
|
),
|
|
|
|
FormActions(
|
|
|
|
HTML("<a class='btn btn-primary btnPrevious'>"+_("Previous")+"</a>"),
|
|
|
|
HTML("<a class='btn btn-primary btnNext pull-right'>"+_("Next")+"</a>")
|
|
|
|
)
|
|
|
|
),
|
|
|
|
Tab(
|
|
|
|
_("Socio-environmental analysis"),
|
2018-03-31 09:59:42 +00:00
|
|
|
'positive_or_negative',
|
2017-11-18 16:54:44 +00:00
|
|
|
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"
|
|
|
|
),
|
2018-03-31 05:29:25 +00:00
|
|
|
Div(
|
2017-11-18 16:54:44 +00:00
|
|
|
'key_actors_involved',
|
|
|
|
css_id="common_questions"
|
|
|
|
),
|
|
|
|
FormActions(
|
|
|
|
HTML("<a class='btn btn-primary btnPrevious'>"+_("Previous")+"</a>"),
|
|
|
|
HTML("<a class='btn btn-primary btnNext pull-right'>"+_("Next")+"</a>")
|
|
|
|
)
|
|
|
|
),
|
2018-03-31 05:29:25 +00:00
|
|
|
Tab(
|
|
|
|
_("Contact details"),
|
|
|
|
'contact_email',
|
|
|
|
'contact_phone',
|
|
|
|
'contact_website',
|
|
|
|
PrependedText('contact_twitter', '@', placeholder='username'),
|
|
|
|
'contact_facebook',
|
|
|
|
'contact_other',
|
|
|
|
FormActions(
|
|
|
|
HTML("<a class='btn btn-primary btnPrevious'>"+_("Previous")+"</a>"),
|
|
|
|
HTML("<a class='btn btn-primary btnNext pull-right'>"+_("Next")+"</a>")
|
|
|
|
)
|
|
|
|
),
|
2017-11-18 16:54:44 +00:00
|
|
|
Tab(
|
|
|
|
_("Uploads"),
|
|
|
|
'official_project_documents',
|
|
|
|
'other_documents',
|
|
|
|
'shapefiles',
|
|
|
|
'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")
|
|
|
|
)
|
2017-10-31 14:57:26 +00:00
|
|
|
)))
|
|
|
|
|
2017-10-08 20:21:51 +00:00
|
|
|
class Meta(BaseCaseStudyForm.Meta):
|
2018-03-27 04:14:01 +00:00
|
|
|
exclude = ('approved',)
|