From d9720363d0575c1570d1888f3a8f75228cbe9650 Mon Sep 17 00:00:00 2001 From: shankar ambady Date: Fri, 17 Oct 2025 12:43:00 -0400 Subject: [PATCH] adding ecosystems subtopic --- .../0020_add_climate_ecosystems_topic.py | 33 +++++++++++++++++++ learning_resources/data/topics.yaml | 5 +++ 2 files changed, 38 insertions(+) create mode 100644 data_fixtures/migrations/0020_add_climate_ecosystems_topic.py diff --git a/data_fixtures/migrations/0020_add_climate_ecosystems_topic.py b/data_fixtures/migrations/0020_add_climate_ecosystems_topic.py new file mode 100644 index 0000000000..eaa6bd59c6 --- /dev/null +++ b/data_fixtures/migrations/0020_add_climate_ecosystems_topic.py @@ -0,0 +1,33 @@ +# Generated by Django 4.2.24 on 2025-10-07 17:07 + +from django.db import migrations + +from data_fixtures.utils import upsert_topic_data_file + + +def remove_climate_offeror(apps, schema_editor): + """ + Remove canvas platform + """ + + LearningResourceTopic = apps.get_model( + "learning_resources", "LearningResourceTopic" + ) + LearningResourceTopic.objects.filter( + name="Ecosystems", parent__name="Energy, Climate & Sustainability" + ).delete() + + +def add_climate_offeror(apps, schema_editor): + # read in updated yaml file and upsert ecosystems subtopic + upsert_topic_data_file() + + +class Migration(migrations.Migration): + dependencies = [ + ("data_fixtures", "0019_add_mit_climate_offerer"), + ] + + operations = [ + migrations.RunPython(add_climate_offeror, remove_climate_offeror), + ] diff --git a/learning_resources/data/topics.yaml b/learning_resources/data/topics.yaml index e3c548c63b..c3bd12cee6 100644 --- a/learning_resources/data/topics.yaml +++ b/learning_resources/data/topics.yaml @@ -684,6 +684,11 @@ topics: - Science name: Science & Math - children: + - children: [] + icon: RiLightbulbFlashLine + id: 94eccea1-f581-4305-a4ca-9270ba0bed87 + mappings: {} + name: Ecosystems - children: [] icon: RiLightbulbFlashLine id: 26fb26b7-326e-4d8e-87c9-3eaf775e9ef4