From 76d329be0bcc5fb89682d46492650b576dce4473 Mon Sep 17 00:00:00 2001 From: Muhammad Sameer Amin <35958006+sameeramin@users.noreply.github.com> Date: Thu, 13 Jun 2024 12:57:51 +0500 Subject: [PATCH 1/5] refactor: made `career_engagement_network_message` nullable --- CHANGELOG.rst | 4 ++++ enterprise/__init__.py | 2 +- ...eer_engagement_network_message_and_more.py | 23 +++++++++++++++++++ enterprise/models.py | 1 + 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 enterprise/migrations/0211_alter_enterprisecustomer_career_engagement_network_message_and_more.py diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d8a568719..80e41dd1b 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -17,6 +17,10 @@ Unreleased ---------- * nothing unreleased +[4.19.18] +--------- +* feat: Makes ``career_engagement_network_message`` field nullable in ``EnterpriseCustomer``. + [4.19.17] --------- * feat: Adds new fields enable_learner_portal_sidebar_message and learner_portal_sidebar_content in EnterpriseCustomer. diff --git a/enterprise/__init__.py b/enterprise/__init__.py index 2f047e896..9be97deb4 100644 --- a/enterprise/__init__.py +++ b/enterprise/__init__.py @@ -2,4 +2,4 @@ Your project description goes here. """ -__version__ = "4.19.17" +__version__ = "4.19.18" diff --git a/enterprise/migrations/0211_alter_enterprisecustomer_career_engagement_network_message_and_more.py b/enterprise/migrations/0211_alter_enterprisecustomer_career_engagement_network_message_and_more.py new file mode 100644 index 000000000..e957a5701 --- /dev/null +++ b/enterprise/migrations/0211_alter_enterprisecustomer_career_engagement_network_message_and_more.py @@ -0,0 +1,23 @@ +# Generated by Django 4.2.10 on 2024-06-13 07:53 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('enterprise', '0210_enterprisecustomer_enable_learner_portal_sidebar_message_and_more'), + ] + + operations = [ + migrations.AlterField( + model_name='enterprisecustomer', + name='career_engagement_network_message', + field=models.TextField(blank=True, help_text='Message text shown on the learner portal dashboard for career engagement network.', null=True), + ), + migrations.AlterField( + model_name='historicalenterprisecustomer', + name='career_engagement_network_message', + field=models.TextField(blank=True, help_text='Message text shown on the learner portal dashboard for career engagement network.', null=True), + ), + ] diff --git a/enterprise/models.py b/enterprise/models.py index 299c2327d..a2bdc1328 100644 --- a/enterprise/models.py +++ b/enterprise/models.py @@ -520,6 +520,7 @@ class Meta: career_engagement_network_message = models.TextField( blank=True, + null=True, help_text=_( 'Message text shown on the learner portal dashboard for career engagement network.' ), From cd6ff64c90155974ec55af0306bcc0493a87373f Mon Sep 17 00:00:00 2001 From: Muhammad Sameer Amin <35958006+sameeramin@users.noreply.github.com> Date: Thu, 13 Jun 2024 14:26:58 +0500 Subject: [PATCH 2/5] feat: registered a signal to copy data from `career_engagement_network_message` --- enterprise/signals.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/enterprise/signals.py b/enterprise/signals.py index d5649aaa5..1fdbae201 100644 --- a/enterprise/signals.py +++ b/enterprise/signals.py @@ -424,3 +424,14 @@ def generate_default_orchestration_record_display_name(sender, instance, **kwarg if COURSE_UNENROLLMENT_COMPLETED is not None: COURSE_UNENROLLMENT_COMPLETED.connect(enterprise_unenrollment_receiver) + + +@receiver(pre_save, sender=models.EnterpriseCustomer) +def copy_data_from_career_engagement_network_message(sender, instance, **kwargs): # pylint: disable=unused-argument + """ + Copy data from `career_engagement_network_message` and `enable_career_engagement_network_on_learner_portal` to + `learner_portal_sidebar_content` and `enable_learner_portal_sidebar_message` respectively. + """ + enable_cen = instance.enable_career_engagement_network_on_learner_portal + instance.learner_portal_sidebar_content = instance.career_engagement_network_message + instance.enable_learner_portal_sidebar_message = enable_cen From c52552ebf5982f33e7befa93a2b1cb4db59996c2 Mon Sep 17 00:00:00 2001 From: Muhammad Sameer Amin <35958006+sameeramin@users.noreply.github.com> Date: Thu, 13 Jun 2024 14:46:53 +0500 Subject: [PATCH 3/5] chore: updated migration name and bumped to latest version --- enterprise/__init__.py | 2 +- ...isecustomer_career_engagement_network_message_and_more.py} | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename enterprise/migrations/{0211_alter_enterprisecustomer_career_engagement_network_message_and_more.py => 0212_alter_enterprisecustomer_career_engagement_network_message_and_more.py} (82%) diff --git a/enterprise/__init__.py b/enterprise/__init__.py index 9b3398d0e..5dc75d12a 100644 --- a/enterprise/__init__.py +++ b/enterprise/__init__.py @@ -2,4 +2,4 @@ Your project description goes here. """ -__version__ = "4.20.0" +__version__ = "4.20.1" diff --git a/enterprise/migrations/0211_alter_enterprisecustomer_career_engagement_network_message_and_more.py b/enterprise/migrations/0212_alter_enterprisecustomer_career_engagement_network_message_and_more.py similarity index 82% rename from enterprise/migrations/0211_alter_enterprisecustomer_career_engagement_network_message_and_more.py rename to enterprise/migrations/0212_alter_enterprisecustomer_career_engagement_network_message_and_more.py index e957a5701..8391f7fc7 100644 --- a/enterprise/migrations/0211_alter_enterprisecustomer_career_engagement_network_message_and_more.py +++ b/enterprise/migrations/0212_alter_enterprisecustomer_career_engagement_network_message_and_more.py @@ -1,4 +1,4 @@ -# Generated by Django 4.2.10 on 2024-06-13 07:53 +# Generated by Django 4.2.10 on 2024-06-13 09:44 from django.db import migrations, models @@ -6,7 +6,7 @@ class Migration(migrations.Migration): dependencies = [ - ('enterprise', '0210_enterprisecustomer_enable_learner_portal_sidebar_message_and_more'), + ('enterprise', '0211_enterprisecustomer_show_videos_in_learner_portal_search_results_and_more'), ] operations = [ From 47c1766d9ac19d33deec47b0312d69018ae74b3f Mon Sep 17 00:00:00 2001 From: Muhammad Sameer Amin <35958006+sameeramin@users.noreply.github.com> Date: Thu, 13 Jun 2024 15:50:07 +0500 Subject: [PATCH 4/5] refactor: updated migrations and models file --- ...mer_career_engagement_network_message_and_more.py | 12 +++++++++++- enterprise/models.py | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/enterprise/migrations/0212_alter_enterprisecustomer_career_engagement_network_message_and_more.py b/enterprise/migrations/0212_alter_enterprisecustomer_career_engagement_network_message_and_more.py index 8391f7fc7..dfbfd8be0 100644 --- a/enterprise/migrations/0212_alter_enterprisecustomer_career_engagement_network_message_and_more.py +++ b/enterprise/migrations/0212_alter_enterprisecustomer_career_engagement_network_message_and_more.py @@ -1,4 +1,4 @@ -# Generated by Django 4.2.10 on 2024-06-13 09:44 +# Generated by Django 4.2.10 on 2024-06-13 10:47 from django.db import migrations, models @@ -15,9 +15,19 @@ class Migration(migrations.Migration): name='career_engagement_network_message', field=models.TextField(blank=True, help_text='Message text shown on the learner portal dashboard for career engagement network.', null=True), ), + migrations.AlterField( + model_name='enterprisecustomer', + name='learner_portal_sidebar_content', + field=models.TextField(blank=True, help_text='Text shown on the learner portal dashboard for customer specific purposes. Open HTML field.', null=True), + ), migrations.AlterField( model_name='historicalenterprisecustomer', name='career_engagement_network_message', field=models.TextField(blank=True, help_text='Message text shown on the learner portal dashboard for career engagement network.', null=True), ), + migrations.AlterField( + model_name='historicalenterprisecustomer', + name='learner_portal_sidebar_content', + field=models.TextField(blank=True, help_text='Text shown on the learner portal dashboard for customer specific purposes. Open HTML field.', null=True), + ), ] diff --git a/enterprise/models.py b/enterprise/models.py index 0d4c273ad..934e47e8c 100644 --- a/enterprise/models.py +++ b/enterprise/models.py @@ -534,6 +534,7 @@ class Meta: learner_portal_sidebar_content = models.TextField( blank=True, + null=True, help_text=_( 'Text shown on the learner portal dashboard for customer specific purposes. Open HTML field.' ), From ad3f52a3cbcbc5468e6feb87f153564201c48ba7 Mon Sep 17 00:00:00 2001 From: Muhammad Sameer Amin <35958006+sameeramin@users.noreply.github.com> Date: Fri, 14 Jun 2024 09:20:16 +0500 Subject: [PATCH 5/5] chore: bumped version to 4.20.3 --- enterprise/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/enterprise/__init__.py b/enterprise/__init__.py index c2b909dab..047d738bd 100644 --- a/enterprise/__init__.py +++ b/enterprise/__init__.py @@ -2,4 +2,4 @@ Your project description goes here. """ -__version__ = "4.20.2" +__version__ = "4.20.3"