diff --git a/course_discovery/apps/api/tests/test_serializers.py b/course_discovery/apps/api/tests/test_serializers.py index 285f1bbd479..ec023e9adf5 100644 --- a/course_discovery/apps/api/tests/test_serializers.py +++ b/course_discovery/apps/api/tests/test_serializers.py @@ -2554,6 +2554,9 @@ def get_expected_data(cls, course_run, course_skill, request): 'first_enrollable_paid_seat_sku': course_run.first_enrollable_paid_seat_sku(), 'first_enrollable_paid_seat_price': course_run.first_enrollable_paid_seat_price, 'is_enrollable': course_run.is_enrollable, + 'restriction_type': ( + course_run.restricted_run.restriction_type if hasattr(course_run, 'restricted_run') else None + ) } diff --git a/course_discovery/apps/course_metadata/admin.py b/course_discovery/apps/course_metadata/admin.py index 5edbf39c56a..f82113efcb9 100644 --- a/course_discovery/apps/course_metadata/admin.py +++ b/course_discovery/apps/course_metadata/admin.py @@ -345,7 +345,7 @@ class CourseLocationRestrictionAdmin(admin.ModelAdmin): @admin.register(TaxiForm) class TaxiFormAdmin(admin.ModelAdmin): - list_display = ('id', 'grouping', 'title') + list_display = ('id', 'grouping', 'title', 'form_id') fields = ('form_id', 'grouping', 'title', 'subtitle', 'post_submit_url') readonly_fields = ('created', 'modified') diff --git a/course_discovery/apps/course_metadata/migrations/0342_additionalmetadata_taxi_form_and_more.py b/course_discovery/apps/course_metadata/migrations/0342_additionalmetadata_taxi_form_and_more.py new file mode 100644 index 00000000000..029e0a490e1 --- /dev/null +++ b/course_discovery/apps/course_metadata/migrations/0342_additionalmetadata_taxi_form_and_more.py @@ -0,0 +1,35 @@ +# Generated by Django 4.2.13 on 2024-07-04 21:07 + +from django.db import migrations, models +import django.db.models.deletion +import multiselectfield.db.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('course_metadata', '0341_restrictedcourserun'), + ] + + operations = [ + migrations.AddField( + model_name='additionalmetadata', + name='taxi_form', + field=models.OneToOneField(blank=True, default=None, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='additional_metadata', to='course_metadata.taxiform'), + ), + migrations.AlterField( + model_name='courselocationrestriction', + name='countries', + field=multiselectfield.db.fields.MultiSelectField(blank=True, choices=[('AF', 'Afghanistan'), ('AX', 'Åland Islands'), ('AL', 'Albania'), ('DZ', 'Algeria'), ('AS', 'American Samoa'), ('AD', 'Andorra'), ('AO', 'Angola'), ('AI', 'Anguilla'), ('AQ', 'Antarctica'), ('AG', 'Antigua and Barbuda'), ('AR', 'Argentina'), ('AM', 'Armenia'), ('AW', 'Aruba'), ('AU', 'Australia'), ('AT', 'Austria'), ('AZ', 'Azerbaijan'), ('BS', 'Bahamas'), ('BH', 'Bahrain'), ('BD', 'Bangladesh'), ('BB', 'Barbados'), ('BY', 'Belarus'), ('BE', 'Belgium'), ('BZ', 'Belize'), ('BJ', 'Benin'), ('BM', 'Bermuda'), ('BT', 'Bhutan'), ('BO', 'Bolivia'), ('BQ', 'Bonaire, Sint Eustatius and Saba'), ('BA', 'Bosnia and Herzegovina'), ('BW', 'Botswana'), ('BV', 'Bouvet Island'), ('BR', 'Brazil'), ('IO', 'British Indian Ocean Territory'), ('BN', 'Brunei'), ('BG', 'Bulgaria'), ('BF', 'Burkina Faso'), ('BI', 'Burundi'), ('CV', 'Cabo Verde'), ('KH', 'Cambodia'), ('CM', 'Cameroon'), ('CA', 'Canada'), ('KY', 'Cayman Islands'), ('CF', 'Central African Republic'), ('TD', 'Chad'), ('CL', 'Chile'), ('CN', 'China'), ('CX', 'Christmas Island'), ('CC', 'Cocos (Keeling) Islands'), ('CO', 'Colombia'), ('KM', 'Comoros'), ('CG', 'Congo'), ('CD', 'Congo (the Democratic Republic of the)'), ('CK', 'Cook Islands'), ('CR', 'Costa Rica'), ('CI', "Côte d'Ivoire"), ('HR', 'Croatia'), ('CU', 'Cuba'), ('CW', 'Curaçao'), ('CY', 'Cyprus'), ('CZ', 'Czechia'), ('DK', 'Denmark'), ('DJ', 'Djibouti'), ('DM', 'Dominica'), ('DO', 'Dominican Republic'), ('EC', 'Ecuador'), ('EG', 'Egypt'), ('SV', 'El Salvador'), ('GQ', 'Equatorial Guinea'), ('ER', 'Eritrea'), ('EE', 'Estonia'), ('SZ', 'Eswatini'), ('ET', 'Ethiopia'), ('FK', 'Falkland Islands (Malvinas)'), ('FO', 'Faroe Islands'), ('FJ', 'Fiji'), ('FI', 'Finland'), ('FR', 'France'), ('GF', 'French Guiana'), ('PF', 'French Polynesia'), ('TF', 'French Southern Territories'), ('GA', 'Gabon'), ('GM', 'Gambia'), ('GE', 'Georgia'), ('DE', 'Germany'), ('GH', 'Ghana'), ('GI', 'Gibraltar'), ('GR', 'Greece'), ('GL', 'Greenland'), ('GD', 'Grenada'), ('GP', 'Guadeloupe'), ('GU', 'Guam'), ('GT', 'Guatemala'), ('GG', 'Guernsey'), ('GN', 'Guinea'), ('GW', 'Guinea-Bissau'), ('GY', 'Guyana'), ('HT', 'Haiti'), ('HM', 'Heard Island and McDonald Islands'), ('VA', 'Holy See'), ('HN', 'Honduras'), ('HK', 'Hong Kong'), ('HU', 'Hungary'), ('IS', 'Iceland'), ('IN', 'India'), ('ID', 'Indonesia'), ('IR', 'Iran'), ('IQ', 'Iraq'), ('IE', 'Ireland'), ('IM', 'Isle of Man'), ('IL', 'Israel'), ('IT', 'Italy'), ('JM', 'Jamaica'), ('JP', 'Japan'), ('JE', 'Jersey'), ('JO', 'Jordan'), ('KZ', 'Kazakhstan'), ('KE', 'Kenya'), ('KI', 'Kiribati'), ('KW', 'Kuwait'), ('KG', 'Kyrgyzstan'), ('LA', 'Laos'), ('LV', 'Latvia'), ('LB', 'Lebanon'), ('LS', 'Lesotho'), ('LR', 'Liberia'), ('LY', 'Libya'), ('LI', 'Liechtenstein'), ('LT', 'Lithuania'), ('LU', 'Luxembourg'), ('MO', 'Macao'), ('MG', 'Madagascar'), ('MW', 'Malawi'), ('MY', 'Malaysia'), ('MV', 'Maldives'), ('ML', 'Mali'), ('MT', 'Malta'), ('MH', 'Marshall Islands'), ('MQ', 'Martinique'), ('MR', 'Mauritania'), ('MU', 'Mauritius'), ('YT', 'Mayotte'), ('MX', 'Mexico'), ('FM', 'Micronesia'), ('MD', 'Moldova'), ('MC', 'Monaco'), ('MN', 'Mongolia'), ('ME', 'Montenegro'), ('MS', 'Montserrat'), ('MA', 'Morocco'), ('MZ', 'Mozambique'), ('MM', 'Myanmar'), ('NA', 'Namibia'), ('NR', 'Nauru'), ('NP', 'Nepal'), ('NL', 'Netherlands'), ('NC', 'New Caledonia'), ('NZ', 'New Zealand'), ('NI', 'Nicaragua'), ('NE', 'Niger'), ('NG', 'Nigeria'), ('NU', 'Niue'), ('NF', 'Norfolk Island'), ('KP', 'North Korea'), ('MK', 'North Macedonia'), ('MP', 'Northern Mariana Islands'), ('NO', 'Norway'), ('OM', 'Oman'), ('PK', 'Pakistan'), ('PW', 'Palau'), ('PS', 'Palestine, State of'), ('PA', 'Panama'), ('PG', 'Papua New Guinea'), ('PY', 'Paraguay'), ('PE', 'Peru'), ('PH', 'Philippines'), ('PN', 'Pitcairn'), ('PL', 'Poland'), ('PT', 'Portugal'), ('PR', 'Puerto Rico'), ('QA', 'Qatar'), ('RE', 'Réunion'), ('RO', 'Romania'), ('RU', 'Russia'), ('RW', 'Rwanda'), ('BL', 'Saint Barthélemy'), ('SH', 'Saint Helena, Ascension and Tristan da Cunha'), ('KN', 'Saint Kitts and Nevis'), ('LC', 'Saint Lucia'), ('MF', 'Saint Martin (French part)'), ('PM', 'Saint Pierre and Miquelon'), ('VC', 'Saint Vincent and the Grenadines'), ('WS', 'Samoa'), ('SM', 'San Marino'), ('ST', 'Sao Tome and Principe'), ('SA', 'Saudi Arabia'), ('SN', 'Senegal'), ('RS', 'Serbia'), ('SC', 'Seychelles'), ('SL', 'Sierra Leone'), ('SG', 'Singapore'), ('SX', 'Sint Maarten (Dutch part)'), ('SK', 'Slovakia'), ('SI', 'Slovenia'), ('SB', 'Solomon Islands'), ('SO', 'Somalia'), ('ZA', 'South Africa'), ('GS', 'South Georgia and the South Sandwich Islands'), ('KR', 'South Korea'), ('SS', 'South Sudan'), ('ES', 'Spain'), ('LK', 'Sri Lanka'), ('SD', 'Sudan'), ('SR', 'Suriname'), ('SJ', 'Svalbard and Jan Mayen'), ('SE', 'Sweden'), ('CH', 'Switzerland'), ('SY', 'Syria'), ('TW', 'Taiwan'), ('TJ', 'Tajikistan'), ('TZ', 'Tanzania'), ('TH', 'Thailand'), ('TL', 'Timor-Leste'), ('TG', 'Togo'), ('TK', 'Tokelau'), ('TO', 'Tonga'), ('TT', 'Trinidad and Tobago'), ('TN', 'Tunisia'), ('TR', 'Türkiye'), ('TM', 'Turkmenistan'), ('TC', 'Turks and Caicos Islands'), ('TV', 'Tuvalu'), ('UG', 'Uganda'), ('UA', 'Ukraine'), ('AE', 'United Arab Emirates'), ('GB', 'United Kingdom'), ('UM', 'United States Minor Outlying Islands'), ('US', 'United States of America'), ('UY', 'Uruguay'), ('UZ', 'Uzbekistan'), ('VU', 'Vanuatu'), ('VE', 'Venezuela'), ('VN', 'Vietnam'), ('VG', 'Virgin Islands (British)'), ('VI', 'Virgin Islands (U.S.)'), ('WF', 'Wallis and Futuna'), ('EH', 'Western Sahara'), ('YE', 'Yemen'), ('ZM', 'Zambia'), ('ZW', 'Zimbabwe')], max_length=249, null=True), + ), + migrations.AlterField( + model_name='programlocationrestriction', + name='countries', + field=multiselectfield.db.fields.MultiSelectField(blank=True, choices=[('AF', 'Afghanistan'), ('AX', 'Åland Islands'), ('AL', 'Albania'), ('DZ', 'Algeria'), ('AS', 'American Samoa'), ('AD', 'Andorra'), ('AO', 'Angola'), ('AI', 'Anguilla'), ('AQ', 'Antarctica'), ('AG', 'Antigua and Barbuda'), ('AR', 'Argentina'), ('AM', 'Armenia'), ('AW', 'Aruba'), ('AU', 'Australia'), ('AT', 'Austria'), ('AZ', 'Azerbaijan'), ('BS', 'Bahamas'), ('BH', 'Bahrain'), ('BD', 'Bangladesh'), ('BB', 'Barbados'), ('BY', 'Belarus'), ('BE', 'Belgium'), ('BZ', 'Belize'), ('BJ', 'Benin'), ('BM', 'Bermuda'), ('BT', 'Bhutan'), ('BO', 'Bolivia'), ('BQ', 'Bonaire, Sint Eustatius and Saba'), ('BA', 'Bosnia and Herzegovina'), ('BW', 'Botswana'), ('BV', 'Bouvet Island'), ('BR', 'Brazil'), ('IO', 'British Indian Ocean Territory'), ('BN', 'Brunei'), ('BG', 'Bulgaria'), ('BF', 'Burkina Faso'), ('BI', 'Burundi'), ('CV', 'Cabo Verde'), ('KH', 'Cambodia'), ('CM', 'Cameroon'), ('CA', 'Canada'), ('KY', 'Cayman Islands'), ('CF', 'Central African Republic'), ('TD', 'Chad'), ('CL', 'Chile'), ('CN', 'China'), ('CX', 'Christmas Island'), ('CC', 'Cocos (Keeling) Islands'), ('CO', 'Colombia'), ('KM', 'Comoros'), ('CG', 'Congo'), ('CD', 'Congo (the Democratic Republic of the)'), ('CK', 'Cook Islands'), ('CR', 'Costa Rica'), ('CI', "Côte d'Ivoire"), ('HR', 'Croatia'), ('CU', 'Cuba'), ('CW', 'Curaçao'), ('CY', 'Cyprus'), ('CZ', 'Czechia'), ('DK', 'Denmark'), ('DJ', 'Djibouti'), ('DM', 'Dominica'), ('DO', 'Dominican Republic'), ('EC', 'Ecuador'), ('EG', 'Egypt'), ('SV', 'El Salvador'), ('GQ', 'Equatorial Guinea'), ('ER', 'Eritrea'), ('EE', 'Estonia'), ('SZ', 'Eswatini'), ('ET', 'Ethiopia'), ('FK', 'Falkland Islands (Malvinas)'), ('FO', 'Faroe Islands'), ('FJ', 'Fiji'), ('FI', 'Finland'), ('FR', 'France'), ('GF', 'French Guiana'), ('PF', 'French Polynesia'), ('TF', 'French Southern Territories'), ('GA', 'Gabon'), ('GM', 'Gambia'), ('GE', 'Georgia'), ('DE', 'Germany'), ('GH', 'Ghana'), ('GI', 'Gibraltar'), ('GR', 'Greece'), ('GL', 'Greenland'), ('GD', 'Grenada'), ('GP', 'Guadeloupe'), ('GU', 'Guam'), ('GT', 'Guatemala'), ('GG', 'Guernsey'), ('GN', 'Guinea'), ('GW', 'Guinea-Bissau'), ('GY', 'Guyana'), ('HT', 'Haiti'), ('HM', 'Heard Island and McDonald Islands'), ('VA', 'Holy See'), ('HN', 'Honduras'), ('HK', 'Hong Kong'), ('HU', 'Hungary'), ('IS', 'Iceland'), ('IN', 'India'), ('ID', 'Indonesia'), ('IR', 'Iran'), ('IQ', 'Iraq'), ('IE', 'Ireland'), ('IM', 'Isle of Man'), ('IL', 'Israel'), ('IT', 'Italy'), ('JM', 'Jamaica'), ('JP', 'Japan'), ('JE', 'Jersey'), ('JO', 'Jordan'), ('KZ', 'Kazakhstan'), ('KE', 'Kenya'), ('KI', 'Kiribati'), ('KW', 'Kuwait'), ('KG', 'Kyrgyzstan'), ('LA', 'Laos'), ('LV', 'Latvia'), ('LB', 'Lebanon'), ('LS', 'Lesotho'), ('LR', 'Liberia'), ('LY', 'Libya'), ('LI', 'Liechtenstein'), ('LT', 'Lithuania'), ('LU', 'Luxembourg'), ('MO', 'Macao'), ('MG', 'Madagascar'), ('MW', 'Malawi'), ('MY', 'Malaysia'), ('MV', 'Maldives'), ('ML', 'Mali'), ('MT', 'Malta'), ('MH', 'Marshall Islands'), ('MQ', 'Martinique'), ('MR', 'Mauritania'), ('MU', 'Mauritius'), ('YT', 'Mayotte'), ('MX', 'Mexico'), ('FM', 'Micronesia'), ('MD', 'Moldova'), ('MC', 'Monaco'), ('MN', 'Mongolia'), ('ME', 'Montenegro'), ('MS', 'Montserrat'), ('MA', 'Morocco'), ('MZ', 'Mozambique'), ('MM', 'Myanmar'), ('NA', 'Namibia'), ('NR', 'Nauru'), ('NP', 'Nepal'), ('NL', 'Netherlands'), ('NC', 'New Caledonia'), ('NZ', 'New Zealand'), ('NI', 'Nicaragua'), ('NE', 'Niger'), ('NG', 'Nigeria'), ('NU', 'Niue'), ('NF', 'Norfolk Island'), ('KP', 'North Korea'), ('MK', 'North Macedonia'), ('MP', 'Northern Mariana Islands'), ('NO', 'Norway'), ('OM', 'Oman'), ('PK', 'Pakistan'), ('PW', 'Palau'), ('PS', 'Palestine, State of'), ('PA', 'Panama'), ('PG', 'Papua New Guinea'), ('PY', 'Paraguay'), ('PE', 'Peru'), ('PH', 'Philippines'), ('PN', 'Pitcairn'), ('PL', 'Poland'), ('PT', 'Portugal'), ('PR', 'Puerto Rico'), ('QA', 'Qatar'), ('RE', 'Réunion'), ('RO', 'Romania'), ('RU', 'Russia'), ('RW', 'Rwanda'), ('BL', 'Saint Barthélemy'), ('SH', 'Saint Helena, Ascension and Tristan da Cunha'), ('KN', 'Saint Kitts and Nevis'), ('LC', 'Saint Lucia'), ('MF', 'Saint Martin (French part)'), ('PM', 'Saint Pierre and Miquelon'), ('VC', 'Saint Vincent and the Grenadines'), ('WS', 'Samoa'), ('SM', 'San Marino'), ('ST', 'Sao Tome and Principe'), ('SA', 'Saudi Arabia'), ('SN', 'Senegal'), ('RS', 'Serbia'), ('SC', 'Seychelles'), ('SL', 'Sierra Leone'), ('SG', 'Singapore'), ('SX', 'Sint Maarten (Dutch part)'), ('SK', 'Slovakia'), ('SI', 'Slovenia'), ('SB', 'Solomon Islands'), ('SO', 'Somalia'), ('ZA', 'South Africa'), ('GS', 'South Georgia and the South Sandwich Islands'), ('KR', 'South Korea'), ('SS', 'South Sudan'), ('ES', 'Spain'), ('LK', 'Sri Lanka'), ('SD', 'Sudan'), ('SR', 'Suriname'), ('SJ', 'Svalbard and Jan Mayen'), ('SE', 'Sweden'), ('CH', 'Switzerland'), ('SY', 'Syria'), ('TW', 'Taiwan'), ('TJ', 'Tajikistan'), ('TZ', 'Tanzania'), ('TH', 'Thailand'), ('TL', 'Timor-Leste'), ('TG', 'Togo'), ('TK', 'Tokelau'), ('TO', 'Tonga'), ('TT', 'Trinidad and Tobago'), ('TN', 'Tunisia'), ('TR', 'Türkiye'), ('TM', 'Turkmenistan'), ('TC', 'Turks and Caicos Islands'), ('TV', 'Tuvalu'), ('UG', 'Uganda'), ('UA', 'Ukraine'), ('AE', 'United Arab Emirates'), ('GB', 'United Kingdom'), ('UM', 'United States Minor Outlying Islands'), ('US', 'United States of America'), ('UY', 'Uruguay'), ('UZ', 'Uzbekistan'), ('VU', 'Vanuatu'), ('VE', 'Venezuela'), ('VN', 'Vietnam'), ('VG', 'Virgin Islands (British)'), ('VI', 'Virgin Islands (U.S.)'), ('WF', 'Wallis and Futuna'), ('EH', 'Western Sahara'), ('YE', 'Yemen'), ('ZM', 'Zambia'), ('ZW', 'Zimbabwe')], max_length=249, null=True), + ), + migrations.AlterField( + model_name='restrictedcourserun', + name='restriction_type', + field=models.CharField(blank=True, choices=[('custom-b2b-enterprise', 'Custom B2B Enterprise'), ('custom-b2c', 'Custom B2C')], help_text='The type of restriction for the course run', max_length=255, null=True), + ), + ] diff --git a/course_discovery/apps/course_metadata/migrations/0343_alter_program_taxi_form.py b/course_discovery/apps/course_metadata/migrations/0343_alter_program_taxi_form.py new file mode 100644 index 00000000000..fdb4e0389f8 --- /dev/null +++ b/course_discovery/apps/course_metadata/migrations/0343_alter_program_taxi_form.py @@ -0,0 +1,19 @@ +# Generated by Django 4.2.13 on 2024-07-05 10:44 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('course_metadata', '0342_additionalmetadata_taxi_form_and_more'), + ] + + operations = [ + migrations.AlterField( + model_name='program', + name='taxi_form', + field=models.OneToOneField(blank=True, default=None, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='program', to='course_metadata.taxiform'), + ), + ] diff --git a/course_discovery/apps/course_metadata/models.py b/course_discovery/apps/course_metadata/models.py index 0c4cdc1beb0..4921c6a35d1 100644 --- a/course_discovery/apps/course_metadata/models.py +++ b/course_discovery/apps/course_metadata/models.py @@ -882,6 +882,9 @@ def has_changed(self): return False return self.has_model_changed() + def __str__(self): + return f"{self.title}({self.form_id})" + class AdditionalMetadata(ManageHistoryMixin, TimeStampedModel): """ @@ -937,6 +940,14 @@ class AdditionalMetadata(ManageHistoryMixin, TimeStampedModel): default=None, related_name="product_additional_metadata" ) + taxi_form = models.OneToOneField( + TaxiForm, + on_delete=models.DO_NOTHING, + blank=True, + null=True, + default=None, + related_name='additional_metadata', + ) product_status = models.CharField( default=ExternalProductStatus.Published, max_length=50, null=False, blank=False, choices=ExternalProductStatus.choices @@ -3300,11 +3311,11 @@ class Program(ManageHistoryMixin, PkSearchableMixin, TimeStampedModel): ) taxi_form = models.OneToOneField( TaxiForm, - on_delete=models.CASCADE, + on_delete=models.DO_NOTHING, blank=True, null=True, default=None, - related_name='taxi_form', + related_name='program', ) program_duration_override = models.CharField( help_text=_( diff --git a/course_discovery/apps/course_metadata/search_indexes/serializers/course_run.py b/course_discovery/apps/course_metadata/search_indexes/serializers/course_run.py index c7f23279bed..1878915293c 100644 --- a/course_discovery/apps/course_metadata/search_indexes/serializers/course_run.py +++ b/course_discovery/apps/course_metadata/search_indexes/serializers/course_run.py @@ -90,6 +90,7 @@ class Meta: 'transcript_languages', 'type', 'weeks_to_complete', + 'restriction_type', ) diff --git a/course_discovery/apps/course_metadata/tests/factories.py b/course_discovery/apps/course_metadata/tests/factories.py index 9797c024b1b..e5e18e0e07c 100644 --- a/course_discovery/apps/course_metadata/tests/factories.py +++ b/course_discovery/apps/course_metadata/tests/factories.py @@ -103,6 +103,17 @@ def keywords(self, create, extracted, **kwargs): add_m2m_data(self.keywords, extracted) +class TaxiFormFactory(factory.django.DjangoModelFactory): + class Meta: + model = TaxiForm + + form_id = FuzzyInteger(1, 10) + grouping = FuzzyText() + title = FuzzyText() + subtitle = FuzzyText() + post_submit_url = FuzzyURL() + + class AdditionalMetadataFactory(factory.django.DjangoModelFactory): class Meta: model = AdditionalMetadata @@ -118,6 +129,7 @@ class Meta: variant_id = factory.LazyFunction(uuid4) course_term_override = FuzzyText() product_meta = factory.SubFactory(ProductMetaFactory, keywords=['test', 'test2']) + taxi_form = factory.SubFactory(TaxiFormFactory) product_status = ExternalProductStatus.Published external_course_marketing_type = FuzzyChoice([name for name, __ in ExternalCourseMarketingType.choices]) display_on_org_page = True @@ -128,17 +140,6 @@ def facts(self, create, extracted, **kwargs): add_m2m_data(self.facts, extracted) -class TaxiFormFactory(factory.django.DjangoModelFactory): - class Meta: - model = TaxiForm - - form_id = FuzzyInteger(1, 10) - grouping = FuzzyText() - title = FuzzyText() - subtitle = FuzzyText() - post_submit_url = FuzzyURL() - - class LevelTypeFactory(AbstractNamedModelFactory): name_t = FuzzyText() diff --git a/course_discovery/apps/course_metadata/tests/test_models.py b/course_discovery/apps/course_metadata/tests/test_models.py index 104f780226a..f64118e1dc2 100644 --- a/course_discovery/apps/course_metadata/tests/test_models.py +++ b/course_discovery/apps/course_metadata/tests/test_models.py @@ -2367,6 +2367,14 @@ def tearDownClass(cls): connect_course_data_modified_timestamp_related_models() super().tearDownClass() + def test_taxi_form(self): + additional_metadata = factories.AdditionalMetadataFactory() + assert additional_metadata.taxi_form is not None + assert additional_metadata.taxi_form.form_id <= 10 + additional_metadata = factories.AdditionalMetadataFactory(taxi_form=None) + additional_metadata.refresh_from_db() + assert additional_metadata.taxi_form is None + def test_update_product_data_modified_timestamp(self): """ Verify that if AdditionalMetadata is changed since last save, the data modified timestamp for related course diff --git a/docker-compose.yml b/docker-compose.yml index 8c298bc5a57..b55663bce84 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -33,7 +33,7 @@ services: - "9300:9300" memcached: - image: memcached:1.6.28 + image: memcached:1.6.29 container_name: memcached course-discovery: diff --git a/requirements/django.txt b/requirements/django.txt index 092a8ec126b..549c1f8bb25 100644 --- a/requirements/django.txt +++ b/requirements/django.txt @@ -1 +1 @@ -django==4.2.13 +django==4.2.14 diff --git a/requirements/docs.txt b/requirements/docs.txt index cdc5cbdaf71..cd53120d9a3 100644 --- a/requirements/docs.txt +++ b/requirements/docs.txt @@ -14,7 +14,7 @@ babel==2.15.0 # sphinx beautifulsoup4==4.12.3 # via pydata-sphinx-theme -certifi==2024.6.2 +certifi==2024.7.4 # via # elasticsearch # requests diff --git a/requirements/local.txt b/requirements/local.txt index a95e81595c9..30a097d6b19 100644 --- a/requirements/local.txt +++ b/requirements/local.txt @@ -30,7 +30,7 @@ asgiref==3.8.1 # django-countries asn1crypto==1.5.1 # via snowflake-connector-python -astroid==3.2.2 +astroid==3.2.3 # via # pylint # pylint-celery @@ -73,9 +73,9 @@ boltons==21.0.0 # face # glom # semgrep -boto3==1.34.136 +boto3==1.34.144 # via django-ses -botocore==1.34.136 +botocore==1.34.144 # via # boto3 # s3transfer @@ -95,7 +95,7 @@ celery==5.4.0 # via # -c requirements/constraints.txt # taxonomy-connector -certifi==2024.6.2 +certifi==2024.7.4 # via # elasticsearch # requests @@ -143,9 +143,9 @@ colorama==0.4.6 # via # semgrep # tox -contentful==2.1.1 +contentful==2.2.0 # via -r requirements/base.in -coverage[toml]==7.5.4 +coverage[toml]==7.6.0 # via # -r requirements/test.in # pytest-cov @@ -281,9 +281,9 @@ django-model-utils==4.5.1 # via taxonomy-connector django-multi-email-field==0.7.0 # via -r requirements/base.in -django-multiselectfield==0.1.12 +django-multiselectfield==0.1.13 # via -r requirements/base.in -django-nested-admin==4.0.2 +django-nested-admin==4.1.0 # via -r requirements/base.in django-nine==0.2.7 # via django-elasticsearch-dsl-drf @@ -297,7 +297,7 @@ django-ses==4.1.0 # via taxonomy-connector django-simple-history==3.7.0 # via -r requirements/base.in -django-solo==2.2.0 +django-solo==2.3.0 # via # -r requirements/base.in # taxonomy-connector @@ -307,7 +307,7 @@ django-stdimage==5.3.0 # via # -c requirements/constraints.txt # -r requirements/base.in -django-storages==1.14.3 +django-storages==1.14.4 # via -r requirements/base.in django-taggit==5.0.1 # via @@ -419,7 +419,7 @@ elasticsearch-dsl==7.4.1 # -r requirements/base.in # django-elasticsearch-dsl # django-elasticsearch-dsl-drf -exceptiongroup==1.2.1 +exceptiongroup==1.2.2 # via # pytest # trio @@ -432,7 +432,7 @@ factory-boy==3.3.0 # via -r requirements/test.in faker==26.0.0 # via factory-boy -fastavro==1.9.4 +fastavro==1.9.5 # via openedx-events filelock==3.15.4 # via @@ -451,9 +451,9 @@ glom==22.1.0 # via semgrep google-api-core==2.19.1 # via google-api-python-client -google-api-python-client==2.135.0 +google-api-python-client==2.137.0 # via -r requirements/base.in -google-auth==2.30.0 +google-auth==2.32.0 # via # google-api-core # google-api-python-client @@ -464,7 +464,7 @@ google-auth-httplib2==0.2.0 # via # -r requirements/base.in # google-api-python-client -google-auth-oauthlib==1.2.0 +google-auth-oauthlib==1.2.1 # via gspread googleapis-common-protos==1.63.2 # via google-api-core @@ -544,7 +544,7 @@ multidict==6.0.5 # yarl mysqlclient==2.2.4 # via -r requirements/test.in -newrelic==9.11.0 +newrelic==9.12.0 # via edx-django-utils oauthlib==3.2.2 # via @@ -579,7 +579,7 @@ path==16.14.0 # via edx-i18n-tools pbr==6.0.0 # via stevedore -peewee==3.17.5 +peewee==3.17.6 # via semgrep pillow==9.5.0 # via @@ -706,7 +706,7 @@ python-lsp-jsonrpc==1.0.0 # via semgrep python-memcached==1.62 # via -r requirements/test.in -python-monkey-business==1.0.0 +python-monkey-business==1.1.0 # via django-nested-admin python-slugify==8.0.4 # via @@ -811,7 +811,6 @@ six==1.16.0 # isodate # jsonschema # python-dateutil - # python-monkey-business slumber==0.7.1 # via edx-rest-api-client sniffio==1.3.1 @@ -820,7 +819,7 @@ snowballstemmer==2.2.0 # via sphinx snowflake-connector-python==3.11.0 # via -r requirements/base.in -social-auth-app-django==5.4.1 +social-auth-app-django==5.4.2 # via # -r requirements/base.in # edx-auth-backends @@ -880,7 +879,7 @@ tomli==2.0.1 # pyproject-api # pytest # tox -tomlkit==0.12.5 +tomlkit==0.13.0 # via # pylint # snowflake-connector-python @@ -901,6 +900,7 @@ typing-extensions==4.12.2 # asgiref # astroid # django-countries + # django-solo # edx-opaque-keys # kombu # pydata-sphinx-theme diff --git a/requirements/pip.txt b/requirements/pip.txt index 43a9dbea18f..60643a880a9 100644 --- a/requirements/pip.txt +++ b/requirements/pip.txt @@ -8,7 +8,7 @@ wheel==0.43.0 # via -r requirements/pip.in # The following packages are considered to be unsafe in a requirements file: -pip==24.1.1 +pip==24.1.2 # via -r requirements/pip.in -setuptools==70.1.1 +setuptools==70.3.0 # via -r requirements/pip.in diff --git a/requirements/production.txt b/requirements/production.txt index 9ebd52bae06..f4d1d1168de 100644 --- a/requirements/production.txt +++ b/requirements/production.txt @@ -50,9 +50,9 @@ beautifulsoup4==4.12.3 # taxonomy-connector billiard==4.2.0 # via celery -boto3==1.34.136 +boto3==1.34.144 # via django-ses -botocore==1.34.136 +botocore==1.34.144 # via # boto3 # s3transfer @@ -68,7 +68,7 @@ celery==5.4.0 # via # -c requirements/constraints.txt # taxonomy-connector -certifi==2024.6.2 +certifi==2024.7.4 # via # -r requirements/production.in # elasticsearch @@ -100,7 +100,7 @@ click-repl==0.3.0 # via celery code-annotations==1.8.0 # via edx-toggles -contentful==2.1.1 +contentful==2.2.0 # via -r requirements/base.in cryptography==42.0.8 # via @@ -116,7 +116,7 @@ defusedxml==0.7.1 # djangorestframework-xml # python3-openid # social-auth-core -django==4.2.13 +django==4.2.14 # via # -c requirements/common_constraints.txt # -c requirements/constraints.txt @@ -219,9 +219,9 @@ django-model-utils==4.5.1 # via taxonomy-connector django-multi-email-field==0.7.0 # via -r requirements/base.in -django-multiselectfield==0.1.12 +django-multiselectfield==0.1.13 # via -r requirements/base.in -django-nested-admin==4.0.2 +django-nested-admin==4.1.0 # via -r requirements/base.in django-nine==0.2.7 # via django-elasticsearch-dsl-drf @@ -237,7 +237,7 @@ django-ses==4.1.0 # taxonomy-connector django-simple-history==3.7.0 # via -r requirements/base.in -django-solo==2.2.0 +django-solo==2.3.0 # via # -r requirements/base.in # taxonomy-connector @@ -247,7 +247,7 @@ django-stdimage==5.3.0 # via # -c requirements/constraints.txt # -r requirements/base.in -django-storages==1.14.3 +django-storages==1.14.4 # via -r requirements/base.in django-taggit==5.0.1 # via @@ -351,7 +351,7 @@ elasticsearch-dsl==7.4.1 # -r requirements/base.in # django-elasticsearch-dsl # django-elasticsearch-dsl-drf -fastavro==1.9.4 +fastavro==1.9.5 # via openedx-events filelock==3.15.4 # via snowflake-connector-python @@ -365,9 +365,9 @@ gevent==24.2.1 # via -r requirements/production.in google-api-core==2.19.1 # via google-api-python-client -google-api-python-client==2.135.0 +google-api-python-client==2.137.0 # via -r requirements/base.in -google-auth==2.30.0 +google-auth==2.32.0 # via # google-api-core # google-api-python-client @@ -378,7 +378,7 @@ google-auth-httplib2==0.2.0 # via # -r requirements/base.in # google-api-python-client -google-auth-oauthlib==1.2.0 +google-auth-oauthlib==1.2.1 # via gspread googleapis-common-protos==1.63.2 # via google-api-core @@ -441,7 +441,7 @@ multidict==6.0.5 # yarl mysqlclient==2.2.4 # via -r requirements/production.in -newrelic==9.11.0 +newrelic==9.12.0 # via # -r requirements/production.in # edx-django-utils @@ -528,7 +528,7 @@ python-dateutil==2.9.0.post0 # elasticsearch-dsl python-memcached==1.62 # via -r requirements/production.in -python-monkey-business==1.0.0 +python-monkey-business==1.1.0 # via django-nested-admin python-slugify==8.0.4 # via @@ -608,12 +608,11 @@ six==1.16.0 # elasticsearch-dsl # isodate # python-dateutil - # python-monkey-business slumber==0.7.1 # via edx-rest-api-client snowflake-connector-python==3.11.0 # via -r requirements/base.in -social-auth-app-django==5.4.1 +social-auth-app-django==5.4.2 # via # -r requirements/base.in # edx-auth-backends @@ -640,7 +639,7 @@ tinycss2==1.3.0 # via # cairosvg # cssselect2 -tomlkit==0.12.5 +tomlkit==0.13.0 # via snowflake-connector-python tqdm==4.66.4 # via openai @@ -648,6 +647,7 @@ typing-extensions==4.12.2 # via # asgiref # django-countries + # django-solo # edx-opaque-keys # kombu # simple-salesforce