From 7cf07b8036488b06c9b670a2d714301bae6be3a6 Mon Sep 17 00:00:00 2001 From: Irtaza Akram <51848298+irtazaakram@users.noreply.github.com> Date: Thu, 5 Oct 2023 23:11:46 +0500 Subject: [PATCH] feat: upgrading django-history package (#4130) --- Makefile | 2 + ...lter_historicalpartner_options_and_more.py | 21 +++++ ...alter_historicalcourse_options_and_more.py | 87 +++++++++++++++++++ ...lorganizationextension_options_and_more.py | 21 +++++ course_discovery/settings/base.py | 3 + requirements/common_constraints.txt | 2 +- requirements/constraints.txt | 5 +- requirements/django.txt | 2 +- requirements/docs.txt | 4 +- requirements/local.txt | 39 ++++----- requirements/production.txt | 31 +++---- 11 files changed, 172 insertions(+), 45 deletions(-) create mode 100644 course_discovery/apps/core/migrations/0020_alter_historicalpartner_options_and_more.py create mode 100644 course_discovery/apps/course_metadata/migrations/0337_alter_historicalcourse_options_and_more.py create mode 100644 course_discovery/apps/publisher/migrations/0003_alter_historicalorganizationextension_options_and_more.py diff --git a/Makefile b/Makefile index c56559a050..02c7b1b9aa 100644 --- a/Makefile +++ b/Makefile @@ -58,6 +58,8 @@ $(COMMON_CONSTRAINTS_TXT): upgrade: $(COMMON_CONSTRAINTS_TXT) + sed 's/django-simple-history==3.0.0//g' requirements/common_constraints.txt > requirements/common_constraints.tmp + mv requirements/common_constraints.tmp requirements/common_constraints.txt pip install -q -r requirements/pip_tools.txt pip-compile --allow-unsafe --upgrade -o requirements/pip.txt requirements/pip.in pip-compile --upgrade -o requirements/pip_tools.txt requirements/pip_tools.in diff --git a/course_discovery/apps/core/migrations/0020_alter_historicalpartner_options_and_more.py b/course_discovery/apps/core/migrations/0020_alter_historicalpartner_options_and_more.py new file mode 100644 index 0000000000..cd569cdc90 --- /dev/null +++ b/course_discovery/apps/core/migrations/0020_alter_historicalpartner_options_and_more.py @@ -0,0 +1,21 @@ +# Generated by Django 4.2.5 on 2023-10-05 05:51 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0019_alter_user_first_name'), + ] + + operations = [ + migrations.AlterModelOptions( + name='historicalpartner', + options={'get_latest_by': ('history_date', 'history_id'), 'ordering': ('-history_date', '-history_id'), 'verbose_name': 'historical Partner', 'verbose_name_plural': 'historical Partners'}, + ), + migrations.AlterModelOptions( + name='historicalsalesforceconfiguration', + options={'get_latest_by': ('history_date', 'history_id'), 'ordering': ('-history_date', '-history_id'), 'verbose_name': 'historical salesforce configuration', 'verbose_name_plural': 'historical salesforce configurations'}, + ), + ] diff --git a/course_discovery/apps/course_metadata/migrations/0337_alter_historicalcourse_options_and_more.py b/course_discovery/apps/course_metadata/migrations/0337_alter_historicalcourse_options_and_more.py new file mode 100644 index 0000000000..fafeffff95 --- /dev/null +++ b/course_discovery/apps/course_metadata/migrations/0337_alter_historicalcourse_options_and_more.py @@ -0,0 +1,87 @@ +# Generated by Django 4.2.5 on 2023-10-05 05:51 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('ietf_language_tags', '0004_auto_20200804_1401'), + ('course_metadata', '0336_update_microbachelors_seat_types'), + ] + + operations = [ + migrations.AlterModelOptions( + name='historicalcourse', + options={'get_latest_by': ('history_date', 'history_id'), 'ordering': ('-history_date', '-history_id'), 'verbose_name': 'historical course', 'verbose_name_plural': 'historical courses'}, + ), + migrations.AlterModelOptions( + name='historicalcourseentitlement', + options={'get_latest_by': ('history_date', 'history_id'), 'ordering': ('-history_date', '-history_id'), 'verbose_name': 'historical course entitlement', 'verbose_name_plural': 'historical course entitlements'}, + ), + migrations.AlterModelOptions( + name='historicalcourserun', + options={'get_latest_by': ('history_date', 'history_id'), 'ordering': ('-history_date', '-history_id'), 'verbose_name': 'historical course run', 'verbose_name_plural': 'historical course runs'}, + ), + migrations.AlterModelOptions( + name='historicalcourseruntype', + options={'get_latest_by': ('history_date', 'history_id'), 'ordering': ('-history_date', '-history_id'), 'verbose_name': 'historical course run type', 'verbose_name_plural': 'historical course run types'}, + ), + migrations.AlterModelOptions( + name='historicalcoursetype', + options={'get_latest_by': ('history_date', 'history_id'), 'ordering': ('-history_date', '-history_id'), 'verbose_name': 'historical course type', 'verbose_name_plural': 'historical course types'}, + ), + migrations.AlterModelOptions( + name='historicalcurriculum', + options={'get_latest_by': ('history_date', 'history_id'), 'ordering': ('-history_date', '-history_id'), 'verbose_name': 'historical curriculum', 'verbose_name_plural': 'historical curriculums'}, + ), + migrations.AlterModelOptions( + name='historicalcurriculumcoursemembership', + options={'get_latest_by': ('history_date', 'history_id'), 'ordering': ('-history_date', '-history_id'), 'verbose_name': 'historical curriculum course membership', 'verbose_name_plural': 'historical curriculum course memberships'}, + ), + migrations.AlterModelOptions( + name='historicalcurriculumcourserunexclusion', + options={'get_latest_by': ('history_date', 'history_id'), 'ordering': ('-history_date', '-history_id'), 'verbose_name': 'historical curriculum course run exclusion', 'verbose_name_plural': 'historical curriculum course run exclusions'}, + ), + migrations.AlterModelOptions( + name='historicalcurriculumprogrammembership', + options={'get_latest_by': ('history_date', 'history_id'), 'ordering': ('-history_date', '-history_id'), 'verbose_name': 'historical curriculum program membership', 'verbose_name_plural': 'historical curriculum program memberships'}, + ), + migrations.AlterModelOptions( + name='historicaldegreecost', + options={'get_latest_by': ('history_date', 'history_id'), 'ordering': ('-history_date', '-history_id'), 'verbose_name': 'historical degree cost', 'verbose_name_plural': 'historical degree costs'}, + ), + migrations.AlterModelOptions( + name='historicaldegreedeadline', + options={'get_latest_by': ('history_date', 'history_id'), 'ordering': ('-history_date', '-history_id'), 'verbose_name': 'historical degree deadline', 'verbose_name_plural': 'historical degree deadlines'}, + ), + migrations.AlterModelOptions( + name='historicalmode', + options={'get_latest_by': ('history_date', 'history_id'), 'ordering': ('-history_date', '-history_id'), 'verbose_name': 'historical mode', 'verbose_name_plural': 'historical modes'}, + ), + migrations.AlterModelOptions( + name='historicalorganization', + options={'get_latest_by': ('history_date', 'history_id'), 'ordering': ('-history_date', '-history_id'), 'verbose_name': 'historical organization', 'verbose_name_plural': 'historical organizations'}, + ), + migrations.AlterModelOptions( + name='historicalprogram', + options={'get_latest_by': ('history_date', 'history_id'), 'ordering': ('-history_date', '-history_id'), 'verbose_name': 'historical program', 'verbose_name_plural': 'historical programs'}, + ), + migrations.AlterModelOptions( + name='historicalprogramtype', + options={'get_latest_by': ('history_date', 'history_id'), 'ordering': ('-history_date', '-history_id'), 'verbose_name': 'historical program type', 'verbose_name_plural': 'historical program types'}, + ), + migrations.AlterModelOptions( + name='historicalseat', + options={'get_latest_by': ('history_date', 'history_id'), 'ordering': ('-history_date', '-history_id'), 'verbose_name': 'historical seat', 'verbose_name_plural': 'historical seats'}, + ), + migrations.AlterModelOptions( + name='historicaltrack', + options={'get_latest_by': ('history_date', 'history_id'), 'ordering': ('-history_date', '-history_id'), 'verbose_name': 'historical track', 'verbose_name_plural': 'historical tracks'}, + ), + migrations.AlterField( + model_name='courserun', + name='video_translation_languages', + field=models.ManyToManyField(blank=True, related_name='+', to='ietf_language_tags.languagetag'), + ), + ] diff --git a/course_discovery/apps/publisher/migrations/0003_alter_historicalorganizationextension_options_and_more.py b/course_discovery/apps/publisher/migrations/0003_alter_historicalorganizationextension_options_and_more.py new file mode 100644 index 0000000000..8209970287 --- /dev/null +++ b/course_discovery/apps/publisher/migrations/0003_alter_historicalorganizationextension_options_and_more.py @@ -0,0 +1,21 @@ +# Generated by Django 4.2.5 on 2023-10-05 05:51 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('publisher', '0002_auto_20200804_1401'), + ] + + operations = [ + migrations.AlterModelOptions( + name='historicalorganizationextension', + options={'get_latest_by': ('history_date', 'history_id'), 'ordering': ('-history_date', '-history_id'), 'verbose_name': 'historical organization extension', 'verbose_name_plural': 'historical organization extensions'}, + ), + migrations.AlterModelOptions( + name='historicalorganizationuserrole', + options={'get_latest_by': ('history_date', 'history_id'), 'ordering': ('-history_date', '-history_id'), 'verbose_name': 'historical organization user role', 'verbose_name_plural': 'historical organization user roles'}, + ), + ] diff --git a/course_discovery/settings/base.py b/course_discovery/settings/base.py index 34c17437f0..6e07f31ec1 100644 --- a/course_discovery/settings/base.py +++ b/course_discovery/settings/base.py @@ -769,4 +769,7 @@ NOTIFY_SLUG_UPDATE_RECIPIENTS = [] +# disable indexing on history_date +SIMPLE_HISTORY_DATE_INDEX = False + CSRF_TRUSTED_ORIGINS_WITH_SCHEME = [] # just for Django 4.2 upgrade diff --git a/requirements/common_constraints.txt b/requirements/common_constraints.txt index afe6aa887f..163513c3e3 100644 --- a/requirements/common_constraints.txt +++ b/requirements/common_constraints.txt @@ -20,7 +20,7 @@ Django<4.0 elasticsearch<7.14.0 # django-simple-history>3.0.0 adds indexing and causes a lot of migrations to be affected -django-simple-history==3.0.0 + # tox>4.0.0 isn't yet compatible with many tox plugins, causing CI failures in almost all repos. # Details can be found in this discussion: https://github.com/tox-dev/tox/discussions/1810 diff --git a/requirements/constraints.txt b/requirements/constraints.txt index ccc918c96b..e08b99d11c 100644 --- a/requirements/constraints.txt +++ b/requirements/constraints.txt @@ -26,9 +26,8 @@ authlib==1.0.0rc1 # The latest version require Django 4.0, remove once we have upgraded to Django 4.0 django-admin-sortable2<2.0.0 -# The latest versions of django-simple-history & django-stdimage have breaking changes +# The latest versions of django-stdimage has breaking changes # Remove this pin after fixing them. -django-simple-history<=3.0.0 django-stdimage<=5.3.0 semgrep==0.102.0 @@ -56,5 +55,5 @@ pillow < 10.0.0 # Awaiting fix https://github.com/Benoss/django-elasticsearch-debug-toolbar/pull/21 to be merged django-debug-toolbar < 4.2.0 -# selenium==4.13.0 causing test failures +# selenium==4.13.0 causing test failures selenium==4.12.0 diff --git a/requirements/django.txt b/requirements/django.txt index 63a8ff0b25..6b297f6ede 100644 --- a/requirements/django.txt +++ b/requirements/django.txt @@ -1,2 +1,2 @@ -django==3.2.21 +django==3.2.22 django-admin-sortable2==1.0.4 diff --git a/requirements/docs.txt b/requirements/docs.txt index 84bf4f6d09..c4bc08e3d5 100644 --- a/requirements/docs.txt +++ b/requirements/docs.txt @@ -8,7 +8,7 @@ accessible-pygments==0.0.4 # via pydata-sphinx-theme alabaster==0.7.13 # via sphinx -babel==2.12.1 +babel==2.13.0 # via # pydata-sphinx-theme # sphinx @@ -93,7 +93,7 @@ sphinxcontrib-serializinghtml==1.1.5 # via sphinx typing-extensions==4.8.0 # via pydata-sphinx-theme -urllib3==1.26.16 +urllib3==1.26.17 # via # elasticsearch # requests diff --git a/requirements/local.txt b/requirements/local.txt index 8aa791ee14..0c152c5a35 100644 --- a/requirements/local.txt +++ b/requirements/local.txt @@ -49,7 +49,7 @@ attrs==21.4.0 # semgrep # trio # zeep -babel==2.12.1 +babel==2.13.0 # via # pydata-sphinx-theme # sphinx @@ -74,9 +74,9 @@ boltons==21.0.0 # face # glom # semgrep -boto3==1.28.57 +boto3==1.28.60 # via django-ses -botocore==1.31.57 +botocore==1.31.60 # via # boto3 # s3transfer @@ -141,7 +141,7 @@ colorama==0.4.6 # via semgrep contentful==2.1.1 # via -r requirements/base.in -coverage[toml]==7.3.1 +coverage[toml]==7.3.2 # via # -r requirements/test.in # pytest-cov @@ -292,11 +292,8 @@ django-parler==2.3 # via -r requirements/base.in django-ses==3.5.0 # via taxonomy-connector -django-simple-history==3.0.0 - # via - # -c requirements/common_constraints.txt - # -c requirements/constraints.txt - # -r requirements/base.in +django-simple-history==3.4.0 + # via -r requirements/base.in django-solo==2.1.0 # via # -r requirements/base.in @@ -390,7 +387,7 @@ edx-drf-extensions==8.2.0 # -r requirements/base.in edx-event-bus-kafka==5.5.0 # via -r requirements/base.in -edx-event-bus-redis==0.3.1 +edx-event-bus-redis==0.3.2 # via -r requirements/base.in edx-i18n-tools==1.2.0 # via -r requirements/local.in @@ -437,7 +434,7 @@ factory-boy==3.3.0 # via -r requirements/test.in faker==19.6.2 # via factory-boy -fastavro==1.8.3 +fastavro==1.8.4 # via openedx-events filelock==3.12.4 # via @@ -458,7 +455,7 @@ glom==22.1.0 # via semgrep google-api-core==2.12.0 # via google-api-python-client -google-api-python-client==2.101.0 +google-api-python-client==2.102.0 # via -r requirements/base.in google-auth==2.23.2 # via @@ -561,7 +558,7 @@ openai==0.28.1 # via taxonomy-connector openedx-atlas==0.5.0 # via -r requirements/base.in -openedx-events==8.6.0 +openedx-events==8.9.0 # via # edx-event-bus-kafka # edx-event-bus-redis @@ -599,7 +596,7 @@ pillow==9.5.0 # -r requirements/base.in # cairosvg # django-stdimage -platformdirs==3.8.1 +platformdirs==3.11.0 # via # pylint # snowflake-connector-python @@ -613,7 +610,7 @@ polib==1.2.0 # via edx-i18n-tools prompt-toolkit==3.0.39 # via click-repl -protobuf==4.24.3 +protobuf==4.24.4 # via # google-api-core # googleapis-common-protos @@ -809,9 +806,9 @@ rjsmin==1.2.1 # via django-compressor rsa==4.9 # via google-auth -ruamel-yaml==0.17.33 +ruamel-yaml==0.17.35 # via semgrep -ruamel-yaml-clib==0.2.7 +ruamel-yaml-clib==0.2.8 # via ruamel-yaml s3transfer==0.7.0 # via boto3 @@ -855,7 +852,7 @@ sniffio==1.3.0 # via trio snowballstemmer==2.2.0 # via sphinx -snowflake-connector-python==3.2.0 +snowflake-connector-python==3.2.1 # via -r requirements/base.in social-auth-app-django==5.3.0 # via @@ -906,7 +903,7 @@ testfixtures==7.2.0 # via -r requirements/test.in text-unidecode==1.3 # via python-slugify -texttable==1.6.7 +texttable==1.7.0 # via docker-compose tinycss2==1.2.1 # via @@ -963,7 +960,7 @@ uritemplate==4.1.1 # via # drf-yasg # google-api-python-client -urllib3[socks]==1.26.16 +urllib3[socks]==1.26.17 # via # botocore # docker @@ -978,7 +975,7 @@ vine==5.0.0 # amqp # celery # kombu -virtualenv==20.24.1 +virtualenv==20.24.5 # via tox walrus==0.9.3 # via edx-event-bus-redis diff --git a/requirements/production.txt b/requirements/production.txt index 71a2116dc8..ab1418acbc 100644 --- a/requirements/production.txt +++ b/requirements/production.txt @@ -49,9 +49,9 @@ beautifulsoup4==4.12.2 # taxonomy-connector billiard==4.1.0 # via celery -boto3==1.28.57 +boto3==1.28.60 # via django-ses -botocore==1.31.57 +botocore==1.31.60 # via # boto3 # s3transfer @@ -117,7 +117,7 @@ defusedxml==0.7.1 # djangorestframework-xml # python3-openid # social-auth-core -django==3.2.21 +django==3.2.22 # via # -c requirements/common_constraints.txt # -c requirements/constraints.txt @@ -234,11 +234,8 @@ django-ses==3.5.0 # via # -r requirements/production.in # taxonomy-connector -django-simple-history==3.0.0 - # via - # -c requirements/common_constraints.txt - # -c requirements/constraints.txt - # -r requirements/base.in +django-simple-history==3.4.0 + # via -r requirements/base.in django-solo==2.1.0 # via # -r requirements/base.in @@ -320,7 +317,7 @@ edx-drf-extensions==8.2.0 # -r requirements/base.in edx-event-bus-kafka==5.5.0 # via -r requirements/base.in -edx-event-bus-redis==0.3.1 +edx-event-bus-redis==0.3.2 # via -r requirements/base.in edx-opaque-keys[django]==2.5.1 # via @@ -350,7 +347,7 @@ elasticsearch-dsl==7.4.1 # -r requirements/base.in # django-elasticsearch-dsl # django-elasticsearch-dsl-drf -fastavro==1.8.3 +fastavro==1.8.4 # via openedx-events filelock==3.12.4 # via snowflake-connector-python @@ -366,7 +363,7 @@ gevent==23.9.1 # via -r requirements/production.in google-api-core==2.12.0 # via google-api-python-client -google-api-python-client==2.101.0 +google-api-python-client==2.102.0 # via -r requirements/base.in google-auth==2.23.2 # via @@ -383,7 +380,7 @@ google-auth-oauthlib==1.1.0 # via gspread googleapis-common-protos==1.60.0 # via google-api-core -greenlet==2.0.2 +greenlet==3.0.0 # via gevent gspread==5.11.3 # via -r requirements/base.in @@ -451,7 +448,7 @@ openai==0.28.1 # via taxonomy-connector openedx-atlas==0.5.0 # via -r requirements/base.in -openedx-events==8.6.0 +openedx-events==8.9.0 # via # edx-event-bus-kafka # edx-event-bus-redis @@ -476,13 +473,13 @@ pillow==9.5.0 # -r requirements/base.in # cairosvg # django-stdimage -platformdirs==3.8.1 +platformdirs==3.11.0 # via # snowflake-connector-python # zeep prompt-toolkit==3.0.39 # via click-repl -protobuf==4.24.3 +protobuf==4.24.4 # via # google-api-core # googleapis-common-protos @@ -630,7 +627,7 @@ six==1.16.0 # requests-file slumber==0.7.1 # via edx-rest-api-client -snowflake-connector-python==3.2.0 +snowflake-connector-python==3.2.1 # via -r requirements/base.in social-auth-app-django==5.3.0 # via @@ -681,7 +678,7 @@ uritemplate==4.1.1 # via # drf-yasg # google-api-python-client -urllib3==1.26.16 +urllib3==1.26.17 # via # botocore # elasticsearch