try localizing number inputs

This commit is contained in:
Anna Sidwell 2019-04-27 23:36:58 +01:00
parent 93db15b740
commit fc7eccb06c

View File

@ -96,6 +96,22 @@ class BaseCaseStudyForm(forms.models.ModelForm):
self.helper.field_class = 'col-md-9'
self.helper.include_media = False
# Parse number fields correctly for the locale
number_fields = [
"area_of_land",
"total_generation_capacity",
"total_investment",
"energy_storage_capacity",
"energy_transmission_capacity",
"area_of_land",
"total_generation_capacity",
"total_investment",
]
for field_name in number_fields:
if field_name in self.fields:
self.fields[field_name].localize = True
class Meta:
model = CaseStudy
fields = '__all__'