diff --git a/network-api/networkapi/wagtailpages/migrations/0162_remove_focusarea_page_and_more.py b/network-api/networkapi/wagtailpages/migrations/0162_remove_focusarea_page_and_more.py index 084d834656..c6e549922d 100644 --- a/network-api/networkapi/wagtailpages/migrations/0162_remove_focusarea_page_and_more.py +++ b/network-api/networkapi/wagtailpages/migrations/0162_remove_focusarea_page_and_more.py @@ -26,9 +26,16 @@ def update_focus_areas_and_add_hero_bottom(apps, schema_editor): }, ] - FocusArea.objects.all().delete() - for area in focus_areas: - FocusArea.objects.create(**area) + existing_focus_areas = list(FocusArea.objects.all()) + + for index, data in enumerate(focus_areas): + if index < len(existing_focus_areas): + focus_area = existing_focus_areas[index] + focus_area.name = data['name'] + focus_area.description = data['description'] + focus_area.save() + else: + FocusArea.objects.create(**data) # Add hero_bottom data to Homepage homepage = Homepage.objects.first() diff --git a/network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/focus_area.html b/network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/focus_area.html index 942448a988..22c233d10a 100644 --- a/network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/focus_area.html +++ b/network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/focus_area.html @@ -4,7 +4,7 @@ {% image area.interest_icon width-100 class="tw-max-w-[4em] tw-max-h-[4em]" alt=area.interest_icon.title %}
{{ area.description }}