From 03cde8c8cb669512494a15f8a700ccbde8d0f3c8 Mon Sep 17 00:00:00 2001 From: muhammad-ammar Date: Mon, 2 Oct 2023 15:26:28 +0500 Subject: [PATCH] feat: add enable_pathways field in enterprisecustomer model --- CHANGELOG.rst | 4 ++++ enterprise/__init__.py | 2 +- enterprise/admin/__init__.py | 2 +- enterprise/admin/forms.py | 1 + enterprise/api/v1/serializers.py | 3 ++- .../migrations/0189_auto_20231002_0902.py | 23 +++++++++++++++++++ enterprise/models.py | 8 +++++++ tests/test_enterprise/api/test_views.py | 5 ++++ tests/test_utilities.py | 1 + 9 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 enterprise/migrations/0189_auto_20231002_0902.py diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 20069758cd..7f69ae8504 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -16,6 +16,10 @@ Change Log Unreleased ---------- +[4.4.0] +------- +feat: Add the ``enable_pathways`` field for EnterpriseCustomer + [4.3.4] ------- feat: add migrations for Django 4.2 diff --git a/enterprise/__init__.py b/enterprise/__init__.py index 0f816ecb43..d0b365447c 100644 --- a/enterprise/__init__.py +++ b/enterprise/__init__.py @@ -2,4 +2,4 @@ Your project description goes here. """ -__version__ = "4.3.4" +__version__ = "4.4.0" diff --git a/enterprise/admin/__init__.py b/enterprise/admin/__init__.py index 3b9a60df61..b28fb8eb00 100644 --- a/enterprise/admin/__init__.py +++ b/enterprise/admin/__init__.py @@ -211,7 +211,7 @@ class EnterpriseCustomerAdmin(DjangoObjectActions, SimpleHistoryAdmin): 'enable_audit_data_reporting', 'enable_learner_portal_offers', 'enable_executive_education_2U_fulfillment', 'enable_career_engagement_network_on_learner_portal', - 'career_engagement_network_message'), + 'career_engagement_network_message', 'enable_pathways'), 'description': ('The following default settings should be the same for ' 'the majority of enterprise customers, ' 'and are either rarely used, unlikely to be sold, ' diff --git a/enterprise/admin/forms.py b/enterprise/admin/forms.py index 0d9474be54..1caa3f521b 100644 --- a/enterprise/admin/forms.py +++ b/enterprise/admin/forms.py @@ -405,6 +405,7 @@ class Meta: "enable_integrated_customer_learner_portal_search", "enable_career_engagement_network_on_learner_portal", "career_engagement_network_message", + "enable_pathways", "enable_analytics_screen", "enable_portal_reporting_config_screen", "enable_portal_saml_configuration_screen", diff --git a/enterprise/api/v1/serializers.py b/enterprise/api/v1/serializers.py index 36ecd555e0..f660c9415e 100644 --- a/enterprise/api/v1/serializers.py +++ b/enterprise/api/v1/serializers.py @@ -221,7 +221,8 @@ class Meta: 'enable_portal_lms_configurations_screen', 'sender_alias', 'identity_providers', 'enterprise_customer_catalogs', 'reply_to', 'enterprise_notification_banner', 'hide_labor_market_data', 'modified', 'enable_universal_link', 'enable_browse_and_request', 'admin_users', - 'enable_career_engagement_network_on_learner_portal', 'career_engagement_network_message' + 'enable_career_engagement_network_on_learner_portal', 'career_engagement_network_message', + 'enable_pathways' ) identity_providers = EnterpriseCustomerIdentityProviderSerializer(many=True, read_only=True) diff --git a/enterprise/migrations/0189_auto_20231002_0902.py b/enterprise/migrations/0189_auto_20231002_0902.py new file mode 100644 index 0000000000..9432635379 --- /dev/null +++ b/enterprise/migrations/0189_auto_20231002_0902.py @@ -0,0 +1,23 @@ +# Generated by Django 3.2.21 on 2023-10-02 09:02 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('enterprise', '0188_alter_learnercreditenterprisecourseenrollment_enterprise_course_enrollment_and_more'), + ] + + operations = [ + migrations.AddField( + model_name='enterprisecustomer', + name='enable_pathways', + field=models.BooleanField(default=True, help_text='If checked, the learners will be able to see the pathways on the learner portal dashboard.', verbose_name='Display pathways screen'), + ), + migrations.AddField( + model_name='historicalenterprisecustomer', + name='enable_pathways', + field=models.BooleanField(default=True, help_text='If checked, the learners will be able to see the pathways on the learner portal dashboard.', verbose_name='Display pathways screen'), + ), + ] diff --git a/enterprise/models.py b/enterprise/models.py index fe204313f4..1290faf660 100644 --- a/enterprise/models.py +++ b/enterprise/models.py @@ -374,6 +374,14 @@ class Meta: ) ) + enable_pathways = models.BooleanField( + verbose_name="Display pathways screen", + default=True, + help_text=_( + "If checked, the learners will be able to see the pathways on the learner portal dashboard." + ) + ) + enable_analytics_screen = models.BooleanField( verbose_name="Display analytics page", default=True, diff --git a/tests/test_enterprise/api/test_views.py b/tests/test_enterprise/api/test_views.py index 28688b4a21..5ea23f4ac5 100644 --- a/tests/test_enterprise/api/test_views.py +++ b/tests/test_enterprise/api/test_views.py @@ -1194,6 +1194,7 @@ class TestEnterpriseCustomerViewSet(BaseTestEnterpriseAPIViews): 'admin_users': [], 'enable_generation_of_api_credentials': False, 'career_engagement_network_message': 'Test message', + 'enable_pathways': True, }], ), ( @@ -1249,6 +1250,7 @@ class TestEnterpriseCustomerViewSet(BaseTestEnterpriseAPIViews): 'admin_users': [], 'enable_generation_of_api_credentials': False, 'career_engagement_network_message': 'Test message', + 'enable_pathways': True, }, 'active': True, 'user_id': 0, 'user': None, 'data_sharing_consent_records': [], 'groups': [], @@ -1336,6 +1338,7 @@ class TestEnterpriseCustomerViewSet(BaseTestEnterpriseAPIViews): 'admin_users': [], 'enable_generation_of_api_credentials': False, 'career_engagement_network_message': 'Test message', + 'enable_pathways': True, }], ), ( @@ -1399,6 +1402,7 @@ class TestEnterpriseCustomerViewSet(BaseTestEnterpriseAPIViews): 'admin_users': [], 'enable_generation_of_api_credentials': False, 'career_engagement_network_message': 'Test message', + 'enable_pathways': True, }], ), ( @@ -1633,6 +1637,7 @@ def test_enterprise_customer_with_access_to( 'admin_users': [], 'enable_generation_of_api_credentials': False, 'career_engagement_network_message': 'Test message', + 'enable_pathways': True, } else: mock_empty_200_success_response = { diff --git a/tests/test_utilities.py b/tests/test_utilities.py index 46fa8490e3..98a45dfdbd 100644 --- a/tests/test_utilities.py +++ b/tests/test_utilities.py @@ -173,6 +173,7 @@ def setUp(self): "enable_generation_of_api_credentials", "career_engagement_network_message", "sso_orchestration_records", + "enable_pathways" ] ), (