diff --git a/course_discovery/apps/course_metadata/migrations/0267_remove_course_slug.py b/course_discovery/apps/course_metadata/migrations/0267_remove_course_slug.py new file mode 100644 index 0000000000..a5ab08d523 --- /dev/null +++ b/course_discovery/apps/course_metadata/migrations/0267_remove_course_slug.py @@ -0,0 +1,17 @@ +# Generated by Django 3.2.10 on 2022-01-13 13:12 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('course_metadata', '0266_auto_20210624_1831'), + ] + + operations = [ + migrations.RemoveField( + model_name='course', + name='slug', + ), + ] diff --git a/course_discovery/apps/course_metadata/models.py b/course_discovery/apps/course_metadata/models.py index 9c622e56ea..055b35ee3f 100644 --- a/course_discovery/apps/course_metadata/models.py +++ b/course_discovery/apps/course_metadata/models.py @@ -804,7 +804,6 @@ class Course(DraftModelMixin, PkSearchableMixin, CachedMixin, TimeStampedModel): }, help_text=_('Add the course image') ) - slug = AutoSlugField(populate_from='key', editable=True, slugify_function=uslugify) video = models.ForeignKey(Video, models.CASCADE, default=None, null=True, blank=True) faq = NullHtmlField(verbose_name=_('FAQ')) learner_testimonials = NullHtmlField() @@ -1047,7 +1046,6 @@ def _update_or_create_official_version(self, course_run): if creating: official_version.canonical_course_run = course_run - official_version.slug = self.slug official_version.save() self.canonical_course_run = course_run.draft_version self.save() diff --git a/course_discovery/apps/course_metadata/tests/test_models.py b/course_discovery/apps/course_metadata/tests/test_models.py index 6d56e3b4cf..9d973039f6 100644 --- a/course_discovery/apps/course_metadata/tests/test_models.py +++ b/course_discovery/apps/course_metadata/tests/test_models.py @@ -929,7 +929,6 @@ def test_official_created(self): assert official_run.course.draft is False assert official_run.course.draft_version == draft_run.course assert official_run.course != draft_run.course - assert official_run.course.slug == draft_run.course.slug official_entitlement = official_run.course.entitlements.first() draft_entitlement = draft_run.course.entitlements.first() diff --git a/course_discovery/apps/course_metadata/tests/test_utils.py b/course_discovery/apps/course_metadata/tests/test_utils.py index b47e8d163e..6aa0f856f5 100644 --- a/course_discovery/apps/course_metadata/tests/test_utils.py +++ b/course_discovery/apps/course_metadata/tests/test_utils.py @@ -408,9 +408,6 @@ def test_ensure_draft_world_not_draft_course_given(self): assert ensured_draft_course.uuid == not_draft_course.uuid assert ensured_draft_course.draft - # Check slugs are equal - assert ensured_draft_course.slug == not_draft_course.slug - # Check authoring orgs are equal assert list(ensured_draft_course.authoring_organizations.all()) ==\ list(not_draft_course.authoring_organizations.all()) diff --git a/course_discovery/apps/course_metadata/utils.py b/course_discovery/apps/course_metadata/utils.py index e063939297..6fcb7c1861 100644 --- a/course_discovery/apps/course_metadata/utils.py +++ b/course_discovery/apps/course_metadata/utils.py @@ -260,7 +260,6 @@ def ensure_draft_world(obj): # We need to null this out because it will fail with a OneToOne uniqueness error when saving the draft obj.canonical_course_run = None draft_course, original_course = set_draft_state(obj, Course, related_attrs={'url_slug_history': []}) - draft_course.slug = original_course.slug # Move editors from the original course to the draft course since we only care about CourseEditors # in the context of draft courses. This code is only necessary during the transition from using