Run black over entire codebase
This commit is contained in:
@ -6,75 +6,72 @@ from django.db import migrations, models
|
||||
import multiselectfield.db.fields
|
||||
|
||||
string_fields = [
|
||||
'additional_technical_details',
|
||||
'associated_infrastructure',
|
||||
'biomass_detail',
|
||||
'community_voices',
|
||||
'contractor_or_supplier_of_technology',
|
||||
'direct_comms',
|
||||
'entry_name',
|
||||
'full_description',
|
||||
'generation_equipment_supplier',
|
||||
'generation_technology',
|
||||
'generation_technology_other',
|
||||
'identified_partnerships',
|
||||
'isolated_or_widespread',
|
||||
'key_actors_involved',
|
||||
'land_ownership',
|
||||
'land_ownership_details',
|
||||
'media_coverage_independent',
|
||||
'media_coverage_mainstream',
|
||||
'minerals_or_commodities',
|
||||
'minerals_or_commodities_other',
|
||||
'name_of_territory_or_area',
|
||||
'negative_case_reasons',
|
||||
'negative_case_reasons_other',
|
||||
'negative_socioenvironmental_impacts',
|
||||
'obstacles_and_hindrances',
|
||||
'positive_case_type',
|
||||
'potential_partnerships',
|
||||
'power_technology',
|
||||
'power_technology_other',
|
||||
'project_status',
|
||||
'project_status_detail',
|
||||
'projected_production_of_commodities',
|
||||
'sector_of_economy',
|
||||
'size_of_concessions',
|
||||
'social_media_links',
|
||||
'socioeconomic_benefits',
|
||||
'type_of_ecosystem',
|
||||
'type_of_extraction',
|
||||
'use_in_energy_economy',
|
||||
'use_in_energy_economy_other',
|
||||
'video_caption',
|
||||
'video_credit',
|
||||
'when_did_organising_start',
|
||||
'who_has_been_involved',
|
||||
"additional_technical_details",
|
||||
"associated_infrastructure",
|
||||
"biomass_detail",
|
||||
"community_voices",
|
||||
"contractor_or_supplier_of_technology",
|
||||
"direct_comms",
|
||||
"entry_name",
|
||||
"full_description",
|
||||
"generation_equipment_supplier",
|
||||
"generation_technology",
|
||||
"generation_technology_other",
|
||||
"identified_partnerships",
|
||||
"isolated_or_widespread",
|
||||
"key_actors_involved",
|
||||
"land_ownership",
|
||||
"land_ownership_details",
|
||||
"media_coverage_independent",
|
||||
"media_coverage_mainstream",
|
||||
"minerals_or_commodities",
|
||||
"minerals_or_commodities_other",
|
||||
"name_of_territory_or_area",
|
||||
"negative_case_reasons",
|
||||
"negative_case_reasons_other",
|
||||
"negative_socioenvironmental_impacts",
|
||||
"obstacles_and_hindrances",
|
||||
"positive_case_type",
|
||||
"potential_partnerships",
|
||||
"power_technology",
|
||||
"power_technology_other",
|
||||
"project_status",
|
||||
"project_status_detail",
|
||||
"projected_production_of_commodities",
|
||||
"sector_of_economy",
|
||||
"size_of_concessions",
|
||||
"social_media_links",
|
||||
"socioeconomic_benefits",
|
||||
"type_of_ecosystem",
|
||||
"type_of_extraction",
|
||||
"use_in_energy_economy",
|
||||
"use_in_energy_economy_other",
|
||||
"video_caption",
|
||||
"video_credit",
|
||||
"when_did_organising_start",
|
||||
"who_has_been_involved",
|
||||
]
|
||||
|
||||
|
||||
def remove_nulls(apps, schema_editor):
|
||||
# We can't import the Person model directly as it may be a newer
|
||||
# version than this migration expects. We use the historical version.
|
||||
CaseStudy = apps.get_model('map', 'CaseStudy')
|
||||
CaseStudy = apps.get_model("map", "CaseStudy")
|
||||
for study in CaseStudy.objects.all():
|
||||
for field in string_fields:
|
||||
if getattr(study, field) == None:
|
||||
setattr(study, field, '')
|
||||
setattr(study, field, "")
|
||||
|
||||
try:
|
||||
study.save()
|
||||
except:
|
||||
from pdb import set_trace; set_trace()
|
||||
from pdb import set_trace
|
||||
|
||||
set_trace()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('map', '0068_casestudydraft_created'),
|
||||
]
|
||||
dependencies = [("map", "0068_casestudydraft_created")]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(remove_nulls, migrations.RunPython.noop),
|
||||
]
|
||||
operations = [migrations.RunPython(remove_nulls, migrations.RunPython.noop)]
|
||||
|
Reference in New Issue
Block a user