Skip to content

Commit

Permalink
Made the requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
aeswibon committed Oct 11, 2022
1 parent c4a376a commit dbe5e4e
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions care/facility/migrations/0315_auto_20220905_1008.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,17 @@ def get_occupation(apps, schema_editor):
patients = PatientRegistration.objects.all()

for patient in patients:
occupation_list.append(
{
"patient": patient,
"occupation": OccupationChoices[patient.meta_info.occupation],
}
)
occupation = ""

if patient.meta_info and patient.meta_info.occupation:
occupation = OccupationChoices[patient.meta_info.occupation]

occupation_list.append(
{
"patient": patient,
"occupation": occupation,
}
)


def populate_occupation(apps, schema_editor):
Expand All @@ -51,7 +56,11 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name="patientmetainfo",
name="occupation",
field=models.CharField(blank=True, max_length=100, null=True),
field=models.CharField(
blank=True,
max_length=100,
null=True,
),
),
migrations.RunPython(populate_occupation, migrations.RunPython.noop),
]

0 comments on commit dbe5e4e

Please sign in to comment.