Fix some untranslatable text

This commit is contained in:
2019-04-27 23:19:34 +01:00
parent 926ae1a85b
commit 93db15b740
4 changed files with 134 additions and 124 deletions

View File

@ -115,14 +115,11 @@ class ShortCaseStudyForm(BaseCaseStudyForm):
super(ShortCaseStudyForm, self).__init__(*args, **kwargs)
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
self.fields['sector_of_economy'].widget = forms.RadioSelect()
self.fields['sector_of_economy'].required = False
self.fields['sector_of_economy'].choices = add_explanatory_text(
CaseStudy.SECTOR_CHOICES,
SECTOR_HELP
)
class Meta(BaseCaseStudyForm.Meta):
@ -175,10 +172,12 @@ class LongCaseStudyForm(BaseCaseStudyForm):
"""Long version of the CaseStudy form."""
images = forms.FileField(
label=_("Images"),
widget=BootstrapClearableFileInput(attrs={
'url': reverse_lazy('files:upload'),
'field': 'images_files',
}), required=False
}),
required=False
)
images_files = forms.ModelMultipleChoiceField(
@ -188,6 +187,7 @@ class LongCaseStudyForm(BaseCaseStudyForm):
)
official_project_documents = forms.FileField(
label=_("Official project documents"),
widget=BootstrapClearableFileInput(attrs={
'url': reverse_lazy('files:upload'),
'field': 'official_project_documents_files',
@ -201,6 +201,7 @@ class LongCaseStudyForm(BaseCaseStudyForm):
)
other_documents = forms.FileField(
label=_("Other documents"),
widget=BootstrapClearableFileInput(attrs={
'url': reverse_lazy('files:upload'),
'field': 'other_documents_files',
@ -229,6 +230,7 @@ class LongCaseStudyForm(BaseCaseStudyForm):
)
coordinate_reference_system = forms.ModelChoiceField(
label=_("Coordinate reference system"),
queryset=SpatialRefSys.objects.all(),
widget=autocomplete.ModelSelect2(url='srs-autocomplete'),
initial=4326,
@ -240,22 +242,18 @@ class LongCaseStudyForm(BaseCaseStudyForm):
self.fields['positive_case_type'].label = ""
self.fields['negative_case_reasons'].label = ""
self.fields['sector_of_economy'] = forms.ChoiceField(
widget=forms.RadioSelect(),
choices=add_explanatory_text(
CaseStudy.SECTOR_CHOICES,
SECTOR_HELP
),
required=False
self.fields['sector_of_economy'].widget = forms.RadioSelect()
self.fields['sector_of_economy'].required = False
self.fields['sector_of_economy'].choices = add_explanatory_text(
CaseStudy.SECTOR_CHOICES,
SECTOR_HELP
)
self.fields['power_technology'] = forms.ChoiceField(
widget=forms.RadioSelect(),
choices=add_explanatory_text(
CaseStudy.POWER_TECHNOLOGY_CHOICES,
POWER_TECHNOLOGY_HELP
),
required=False
self.fields['power_technology'].widget = forms.RadioSelect()
self.fields['power_technology'].required = False
self.fields['power_technology'].choices = add_explanatory_text(
CaseStudy.POWER_TECHNOLOGY_CHOICES,
POWER_TECHNOLOGY_HELP
)
self.fields['project_owners'].required = True