Attempt a different migration to remove null from text fields

This commit is contained in:
Anna Sidwell 2018-10-05 09:29:24 -04:00
parent 6220f62af3
commit 190f63abf8

View File

@ -62,7 +62,7 @@ def remove_nulls(apps, schema_editor):
study = apps.get_model('map', 'CaseStudy') study = apps.get_model('map', 'CaseStudy')
for study in CaseStudy.objects.all(): for study in CaseStudy.objects.all():
for field in string_fields: for field in string_fields:
if study._meta.get_field(field) == None: if getattr(study, field) == None:
setattr(study, field, '') setattr(study, field, '')
study.save() study.save()