diff --git a/common/djangoapps/course_action_state/migrations/0001_initial.py b/common/djangoapps/course_action_state/migrations/0001_initial.py index c95f5f8688..e725bb5bce 100644 --- a/common/djangoapps/course_action_state/migrations/0001_initial.py +++ b/common/djangoapps/course_action_state/migrations/0001_initial.py @@ -4,7 +4,7 @@ from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion from django.conf import settings -import xmodule_django.models +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField class Migration(migrations.Migration): @@ -20,12 +20,12 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('created_time', models.DateTimeField(auto_now_add=True)), ('updated_time', models.DateTimeField(auto_now=True)), - ('course_key', xmodule_django.models.CourseKeyField(max_length=255, db_index=True)), + ('course_key', CourseKeyField(max_length=255, db_index=True)), ('action', models.CharField(max_length=100, db_index=True)), ('state', models.CharField(max_length=50)), ('should_display', models.BooleanField(default=False)), ('message', models.CharField(max_length=1000)), - ('source_course_key', xmodule_django.models.CourseKeyField(max_length=255, db_index=True)), + ('source_course_key', CourseKeyField(max_length=255, db_index=True)), ('display_name', models.CharField(default=b'', max_length=255, blank=True)), ('created_user', models.ForeignKey(related_name='created_by_user+', on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, null=True)), ('updated_user', models.ForeignKey(related_name='updated_by_user+', on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, null=True)), diff --git a/common/djangoapps/course_action_state/models.py b/common/djangoapps/course_action_state/models.py index 6c2985018a..be1c47ff5a 100644 --- a/common/djangoapps/course_action_state/models.py +++ b/common/djangoapps/course_action_state/models.py @@ -11,7 +11,7 @@ file and check it in at the same time as your model changes. To do that, """ from django.contrib.auth.models import User from django.db import models -from xmodule_django.models import CourseKeyField +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField from course_action_state.managers import CourseActionStateManager, CourseRerunUIStateManager diff --git a/common/djangoapps/course_modes/migrations/0001_initial.py b/common/djangoapps/course_modes/migrations/0001_initial.py index a16a22cb8d..be40d77c0b 100644 --- a/common/djangoapps/course_modes/migrations/0001_initial.py +++ b/common/djangoapps/course_modes/migrations/0001_initial.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.db import migrations, models -import xmodule_django.models +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField class Migration(migrations.Migration): @@ -15,7 +15,7 @@ class Migration(migrations.Migration): name='CourseMode', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('course_id', xmodule_django.models.CourseKeyField(max_length=255, verbose_name='Course', db_index=True)), + ('course_id', CourseKeyField(max_length=255, verbose_name='Course', db_index=True)), ('mode_slug', models.CharField(max_length=100, verbose_name='Mode')), ('mode_display_name', models.CharField(max_length=255, verbose_name='Display Name')), ('min_price', models.IntegerField(default=0, verbose_name='Price')), @@ -31,7 +31,7 @@ class Migration(migrations.Migration): name='CourseModesArchive', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('course_id', xmodule_django.models.CourseKeyField(max_length=255, db_index=True)), + ('course_id', CourseKeyField(max_length=255, db_index=True)), ('mode_slug', models.CharField(max_length=100)), ('mode_display_name', models.CharField(max_length=255)), ('min_price', models.IntegerField(default=0)), diff --git a/common/djangoapps/course_modes/models.py b/common/djangoapps/course_modes/models.py index f2fe149564..51999ff3bf 100644 --- a/common/djangoapps/course_modes/models.py +++ b/common/djangoapps/course_modes/models.py @@ -10,7 +10,7 @@ from django.core.exceptions import ValidationError from django.db import models from django.db.models import Q from django.utils.translation import ugettext_lazy as _ -from xmodule_django.models import CourseKeyField +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField Mode = namedtuple('Mode', [ diff --git a/common/djangoapps/django_comment_common/migrations/0001_initial.py b/common/djangoapps/django_comment_common/migrations/0001_initial.py index 2eb8f7a533..be2b46e29b 100644 --- a/common/djangoapps/django_comment_common/migrations/0001_initial.py +++ b/common/djangoapps/django_comment_common/migrations/0001_initial.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals from django.db import migrations, models from django.conf import settings -import xmodule_django.models +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField class Migration(migrations.Migration): @@ -27,7 +27,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('name', models.CharField(max_length=30)), - ('course_id', xmodule_django.models.CourseKeyField(db_index=True, max_length=255, blank=True)), + ('course_id', CourseKeyField(db_index=True, max_length=255, blank=True)), ('users', models.ManyToManyField(related_name='roles', to=settings.AUTH_USER_MODEL)), ], options={ diff --git a/common/djangoapps/django_comment_common/models.py b/common/djangoapps/django_comment_common/models.py index b6f804543d..b3c046f920 100644 --- a/common/djangoapps/django_comment_common/models.py +++ b/common/djangoapps/django_comment_common/models.py @@ -12,7 +12,7 @@ from student.models import CourseEnrollment from xmodule.modulestore.django import modulestore from xmodule.modulestore.exceptions import ItemNotFoundError -from xmodule_django.models import CourseKeyField, NoneToEmptyManager +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField, NoneToEmptyManager FORUM_ROLE_ADMINISTRATOR = ugettext_noop('Administrator') FORUM_ROLE_MODERATOR = ugettext_noop('Moderator') diff --git a/common/djangoapps/embargo/migrations/0001_initial.py b/common/djangoapps/embargo/migrations/0001_initial.py index 827928930a..f0ff3def0f 100644 --- a/common/djangoapps/embargo/migrations/0001_initial.py +++ b/common/djangoapps/embargo/migrations/0001_initial.py @@ -5,7 +5,7 @@ from django.db import migrations, models import django_countries.fields import django.db.models.deletion from django.conf import settings -import xmodule_django.models +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField class Migration(migrations.Migration): @@ -38,7 +38,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('timestamp', models.DateTimeField(auto_now_add=True, db_index=True)), - ('course_key', xmodule_django.models.CourseKeyField(max_length=255, db_index=True)), + ('course_key', CourseKeyField(max_length=255, db_index=True)), ('snapshot', models.TextField(null=True, blank=True)), ], options={ @@ -49,7 +49,7 @@ class Migration(migrations.Migration): name='EmbargoedCourse', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('course_id', xmodule_django.models.CourseKeyField(unique=True, max_length=255, db_index=True)), + ('course_id', CourseKeyField(unique=True, max_length=255, db_index=True)), ('embargoed', models.BooleanField(default=False)), ], ), @@ -86,7 +86,7 @@ class Migration(migrations.Migration): name='RestrictedCourse', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('course_key', xmodule_django.models.CourseKeyField(help_text='The course key for the restricted course.', unique=True, max_length=255, db_index=True)), + ('course_key', CourseKeyField(help_text='The course key for the restricted course.', unique=True, max_length=255, db_index=True)), ('enroll_msg_key', models.CharField(default=b'default', help_text='The message to show when a user is blocked from enrollment.', max_length=255, choices=[(b'default', b'Default'), (b'embargo', b'Embargo')])), ('access_msg_key', models.CharField(default=b'default', help_text='The message to show when a user is blocked from accessing a course.', max_length=255, choices=[(b'default', b'Default'), (b'embargo', b'Embargo')])), ('disable_access_check', models.BooleanField(default=False, help_text='Allow users who enrolled in an allowed country to access restricted courses from excluded countries.')), diff --git a/common/djangoapps/embargo/models.py b/common/djangoapps/embargo/models.py index 3cbcd97f30..4c7f4ff055 100644 --- a/common/djangoapps/embargo/models.py +++ b/common/djangoapps/embargo/models.py @@ -25,7 +25,7 @@ from django_countries.fields import CountryField from django_countries import countries from config_models.models import ConfigurationModel -from xmodule_django.models import CourseKeyField, NoneToEmptyManager +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField, NoneToEmptyManager from embargo.exceptions import InvalidAccessPoint from embargo.messages import ENROLL_MESSAGES, COURSEWARE_MESSAGES diff --git a/common/djangoapps/status/migrations/0001_initial.py b/common/djangoapps/status/migrations/0001_initial.py index 7eefeb320c..80efc998db 100644 --- a/common/djangoapps/status/migrations/0001_initial.py +++ b/common/djangoapps/status/migrations/0001_initial.py @@ -4,7 +4,7 @@ from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion from django.conf import settings -import xmodule_django.models +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField class Migration(migrations.Migration): @@ -18,7 +18,7 @@ class Migration(migrations.Migration): name='CourseMessage', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('course_key', xmodule_django.models.CourseKeyField(db_index=True, max_length=255, blank=True)), + ('course_key', CourseKeyField(db_index=True, max_length=255, blank=True)), ('message', models.TextField(null=True, blank=True)), ], ), diff --git a/common/djangoapps/status/models.py b/common/djangoapps/status/models.py index 766b3bac65..c9bf4f6145 100644 --- a/common/djangoapps/status/models.py +++ b/common/djangoapps/status/models.py @@ -6,7 +6,7 @@ from django.db import models from django.contrib import admin from django.core.cache import cache -from xmodule_django.models import CourseKeyField +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField from config_models.models import ConfigurationModel from config_models.admin import ConfigurationModelAdmin diff --git a/common/djangoapps/student/migrations/0001_initial.py b/common/djangoapps/student/migrations/0001_initial.py index 9bb87bae63..f4ed4cfcba 100644 --- a/common/djangoapps/student/migrations/0001_initial.py +++ b/common/djangoapps/student/migrations/0001_initial.py @@ -6,7 +6,7 @@ import django.utils.timezone import django_countries.fields import django.db.models.deletion from django.conf import settings -import xmodule_django.models +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField class Migration(migrations.Migration): @@ -21,7 +21,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('anonymous_user_id', models.CharField(unique=True, max_length=32)), - ('course_id', xmodule_django.models.CourseKeyField(db_index=True, max_length=255, blank=True)), + ('course_id', CourseKeyField(db_index=True, max_length=255, blank=True)), ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)), ], ), @@ -30,7 +30,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('org', models.CharField(db_index=True, max_length=64, blank=True)), - ('course_id', xmodule_django.models.CourseKeyField(db_index=True, max_length=255, blank=True)), + ('course_id', CourseKeyField(db_index=True, max_length=255, blank=True)), ('role', models.CharField(max_length=64, db_index=True)), ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)), ], @@ -39,7 +39,7 @@ class Migration(migrations.Migration): name='CourseEnrollment', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('course_id', xmodule_django.models.CourseKeyField(max_length=255, db_index=True)), + ('course_id', CourseKeyField(max_length=255, db_index=True)), ('created', models.DateTimeField(db_index=True, auto_now_add=True, null=True)), ('is_active', models.BooleanField(default=True)), ('mode', models.CharField(default=b'honor', max_length=100)), @@ -54,7 +54,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('email', models.CharField(max_length=255, db_index=True)), - ('course_id', xmodule_django.models.CourseKeyField(max_length=255, db_index=True)), + ('course_id', CourseKeyField(max_length=255, db_index=True)), ('auto_enroll', models.BooleanField(default=0)), ('created', models.DateTimeField(db_index=True, auto_now_add=True, null=True)), ], @@ -101,7 +101,7 @@ class Migration(migrations.Migration): name='EntranceExamConfiguration', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('course_id', xmodule_django.models.CourseKeyField(max_length=255, db_index=True)), + ('course_id', CourseKeyField(max_length=255, db_index=True)), ('created', models.DateTimeField(db_index=True, auto_now_add=True, null=True)), ('updated', models.DateTimeField(auto_now=True, db_index=True)), ('skip_entrance_exam', models.BooleanField(default=True)), @@ -112,7 +112,7 @@ class Migration(migrations.Migration): name='HistoricalCourseEnrollment', fields=[ ('id', models.IntegerField(verbose_name='ID', db_index=True, auto_created=True, blank=True)), - ('course_id', xmodule_django.models.CourseKeyField(max_length=255, db_index=True)), + ('course_id', CourseKeyField(max_length=255, db_index=True)), ('created', models.DateTimeField(db_index=True, null=True, editable=False, blank=True)), ('is_active', models.BooleanField(default=True)), ('mode', models.CharField(default=b'honor', max_length=100)), diff --git a/common/djangoapps/student/models.py b/common/djangoapps/student/models.py index fc0f0ef3e8..cb5cc70766 100644 --- a/common/djangoapps/student/models.py +++ b/common/djangoapps/student/models.py @@ -45,7 +45,7 @@ from opaque_keys.edx.keys import CourseKey from opaque_keys.edx.locations import SlashSeparatedCourseKey from simple_history.models import HistoricalRecords from track import contexts -from xmodule_django.models import CourseKeyField, NoneToEmptyManager +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField, NoneToEmptyManager from lms.djangoapps.badges.utils import badges_enabled from certificates.models import GeneratedCertificate diff --git a/common/djangoapps/student/roles.py b/common/djangoapps/student/roles.py index c8b8796420..6205228816 100644 --- a/common/djangoapps/student/roles.py +++ b/common/djangoapps/student/roles.py @@ -9,7 +9,7 @@ from django.contrib.auth.models import User import logging from student.models import CourseAccessRole -from xmodule_django.models import CourseKeyField +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField log = logging.getLogger(__name__) diff --git a/lms/djangoapps/badges/api/views.py b/lms/djangoapps/badges/api/views.py index 060d11d05f..3dd4a1de30 100644 --- a/lms/djangoapps/badges/api/views.py +++ b/lms/djangoapps/badges/api/views.py @@ -11,7 +11,7 @@ from openedx.core.lib.api.authentication import ( OAuth2AuthenticationAllowInactiveUser, SessionAuthenticationAllowInactiveUser ) -from xmodule_django.models import CourseKeyField +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField from badges.models import BadgeAssertion from .serializers import BadgeAssertionSerializer diff --git a/lms/djangoapps/badges/migrations/0001_initial.py b/lms/djangoapps/badges/migrations/0001_initial.py index 2ffcb14702..70c81efad4 100644 --- a/lms/djangoapps/badges/migrations/0001_initial.py +++ b/lms/djangoapps/badges/migrations/0001_initial.py @@ -7,7 +7,7 @@ import badges.models from django.conf import settings import django.utils.timezone from model_utils import fields -import xmodule_django.models +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField class Migration(migrations.Migration): @@ -36,7 +36,7 @@ class Migration(migrations.Migration): ('slug', models.SlugField(max_length=255, validators=[badges.models.validate_lowercase])), ('issuing_component', models.SlugField(default=b'', blank=True, validators=[badges.models.validate_lowercase])), ('display_name', models.CharField(max_length=255)), - ('course_id', xmodule_django.models.CourseKeyField(default=None, max_length=255, blank=True)), + ('course_id', CourseKeyField(default=None, max_length=255, blank=True)), ('description', models.TextField()), ('criteria', models.TextField()), ('mode', models.CharField(default=b'', max_length=100, blank=True)), diff --git a/lms/djangoapps/badges/models.py b/lms/djangoapps/badges/models.py index 5f4b5a4d04..484e7cd110 100644 --- a/lms/djangoapps/badges/models.py +++ b/lms/djangoapps/badges/models.py @@ -17,7 +17,7 @@ from opaque_keys.edx.keys import CourseKey from badges.utils import deserialize_count_specs from config_models.models import ConfigurationModel from xmodule.modulestore.django import modulestore -from xmodule_django.models import CourseKeyField +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField def validate_badge_image(image): diff --git a/lms/djangoapps/bulk_email/migrations/0001_initial.py b/lms/djangoapps/bulk_email/migrations/0001_initial.py index 479a1b3a97..6b6ef2f912 100644 --- a/lms/djangoapps/bulk_email/migrations/0001_initial.py +++ b/lms/djangoapps/bulk_email/migrations/0001_initial.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals from django.db import migrations, models from django.conf import settings -import xmodule_django.models +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField class Migration(migrations.Migration): @@ -17,7 +17,7 @@ class Migration(migrations.Migration): name='CourseAuthorization', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('course_id', xmodule_django.models.CourseKeyField(unique=True, max_length=255, db_index=True)), + ('course_id', CourseKeyField(unique=True, max_length=255, db_index=True)), ('email_enabled', models.BooleanField(default=False)), ], ), @@ -31,7 +31,7 @@ class Migration(migrations.Migration): ('text_message', models.TextField(null=True, blank=True)), ('created', models.DateTimeField(auto_now_add=True)), ('modified', models.DateTimeField(auto_now=True)), - ('course_id', xmodule_django.models.CourseKeyField(max_length=255, db_index=True)), + ('course_id', CourseKeyField(max_length=255, db_index=True)), ('to_option', models.CharField(default=b'myself', max_length=64, choices=[(b'myself', b'Myself'), (b'staff', b'Staff and instructors'), (b'all', b'All')])), ('template_name', models.CharField(max_length=255, null=True)), ('from_addr', models.CharField(max_length=255, null=True)), @@ -51,7 +51,7 @@ class Migration(migrations.Migration): name='Optout', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('course_id', xmodule_django.models.CourseKeyField(max_length=255, db_index=True)), + ('course_id', CourseKeyField(max_length=255, db_index=True)), ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, null=True)), ], ), diff --git a/lms/djangoapps/bulk_email/models.py b/lms/djangoapps/bulk_email/models.py index 1beceaa54f..34c8b53397 100644 --- a/lms/djangoapps/bulk_email/models.py +++ b/lms/djangoapps/bulk_email/models.py @@ -15,7 +15,7 @@ from openedx.core.lib.mail_utils import wrap_message from config_models.models import ConfigurationModel from student.roles import CourseStaffRole, CourseInstructorRole -from xmodule_django.models import CourseKeyField +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField from util.keyword_substitution import substitute_keywords_with_data from util.query import use_read_replica_if_available diff --git a/lms/djangoapps/ccx/migrations/0001_initial.py b/lms/djangoapps/ccx/migrations/0001_initial.py index c13c74f996..a31ac453f7 100644 --- a/lms/djangoapps/ccx/migrations/0001_initial.py +++ b/lms/djangoapps/ccx/migrations/0001_initial.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals from django.db import migrations, models from django.conf import settings -import xmodule_django.models +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField, LocationKeyField class Migration(migrations.Migration): @@ -17,7 +17,7 @@ class Migration(migrations.Migration): name='CcxFieldOverride', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('location', xmodule_django.models.LocationKeyField(max_length=255, db_index=True)), + ('location', LocationKeyField(max_length=255, db_index=True)), ('field', models.CharField(max_length=255)), ('value', models.TextField(default=b'null')), ], @@ -26,7 +26,7 @@ class Migration(migrations.Migration): name='CustomCourseForEdX', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('course_id', xmodule_django.models.CourseKeyField(max_length=255, db_index=True)), + ('course_id', CourseKeyField(max_length=255, db_index=True)), ('display_name', models.CharField(max_length=255)), ('coach', models.ForeignKey(to=settings.AUTH_USER_MODEL)), ], diff --git a/lms/djangoapps/ccx/models.py b/lms/djangoapps/ccx/models.py index 5c6e8dd103..3b6c69b4f7 100644 --- a/lms/djangoapps/ccx/models.py +++ b/lms/djangoapps/ccx/models.py @@ -11,7 +11,7 @@ from pytz import utc from lazy import lazy from openedx.core.lib.time_zone_utils import get_time_zone_abbr -from xmodule_django.models import CourseKeyField, LocationKeyField +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField, LocationKeyField from xmodule.error_module import ErrorDescriptor from xmodule.modulestore.django import modulestore diff --git a/lms/djangoapps/certificates/api.py b/lms/djangoapps/certificates/api.py index 131e0ae2e3..84efeed4ca 100644 --- a/lms/djangoapps/certificates/api.py +++ b/lms/djangoapps/certificates/api.py @@ -15,7 +15,7 @@ from opaque_keys.edx.keys import CourseKey from branding import api as branding_api from openedx.core.djangoapps.content.course_overviews.models import CourseOverview from xmodule.modulestore.django import modulestore -from xmodule_django.models import CourseKeyField +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField from util.organizations_helpers import get_course_organizations from certificates.models import ( diff --git a/lms/djangoapps/certificates/migrations/0001_initial.py b/lms/djangoapps/certificates/migrations/0001_initial.py index 4584d6eb8e..ddc3116256 100644 --- a/lms/djangoapps/certificates/migrations/0001_initial.py +++ b/lms/djangoapps/certificates/migrations/0001_initial.py @@ -4,13 +4,13 @@ from __future__ import unicode_literals from django.db import migrations, models import certificates.models import model_utils.fields -import xmodule_django.models import django_extensions.db.fields import django_extensions.db.fields.json import django.db.models.deletion import django.utils.timezone from badges.models import validate_badge_image from django.conf import settings +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField class Migration(migrations.Migration): @@ -24,7 +24,7 @@ class Migration(migrations.Migration): name='BadgeAssertion', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('course_id', xmodule_django.models.CourseKeyField(default=None, max_length=255, blank=True)), + ('course_id', CourseKeyField(default=None, max_length=255, blank=True)), ('mode', models.CharField(max_length=100)), ('data', django_extensions.db.fields.json.JSONField()), ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)), @@ -58,7 +58,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, verbose_name='created', editable=False)), ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, verbose_name='modified', editable=False)), - ('course_key', xmodule_django.models.CourseKeyField(max_length=255, db_index=True)), + ('course_key', CourseKeyField(max_length=255, db_index=True)), ('enabled', models.BooleanField(default=False)), ], options={ @@ -89,7 +89,7 @@ class Migration(migrations.Migration): ('description', models.CharField(help_text='Description and/or admin notes.', max_length=255, null=True, blank=True)), ('template', models.TextField(help_text='Django template HTML.')), ('organization_id', models.IntegerField(help_text='Organization of template.', null=True, db_index=True, blank=True)), - ('course_key', xmodule_django.models.CourseKeyField(db_index=True, max_length=255, null=True, blank=True)), + ('course_key', CourseKeyField(db_index=True, max_length=255, null=True, blank=True)), ('mode', models.CharField(default=b'honor', choices=[(b'verified', b'verified'), (b'honor', b'honor'), (b'audit', b'audit'), (b'professional', b'professional'), (b'no-id-professional', b'no-id-professional')], max_length=125, blank=True, help_text='The course mode for this template.', null=True)), ('is_active', models.BooleanField(default=False, help_text='On/Off switch.')), ], @@ -114,7 +114,7 @@ class Migration(migrations.Migration): name='CertificateWhitelist', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('course_id', xmodule_django.models.CourseKeyField(default=None, max_length=255, blank=True)), + ('course_id', CourseKeyField(default=None, max_length=255, blank=True)), ('whitelist', models.BooleanField(default=0)), ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, verbose_name='created')), ('notes', models.TextField(default=None, null=True)), @@ -143,7 +143,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, verbose_name='created', editable=False)), ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, verbose_name='modified', editable=False)), - ('course_key', xmodule_django.models.CourseKeyField(max_length=255, db_index=True)), + ('course_key', CourseKeyField(max_length=255, db_index=True)), ], options={ 'get_latest_by': 'created', @@ -153,7 +153,7 @@ class Migration(migrations.Migration): name='GeneratedCertificate', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('course_id', xmodule_django.models.CourseKeyField(default=None, max_length=255, blank=True)), + ('course_id', CourseKeyField(default=None, max_length=255, blank=True)), ('verify_uuid', models.CharField(default=b'', max_length=32, blank=True)), ('download_uuid', models.CharField(default=b'', max_length=32, blank=True)), ('download_url', models.CharField(default=b'', max_length=128, blank=True)), diff --git a/lms/djangoapps/certificates/migrations/0004_certificategenerationhistory.py b/lms/djangoapps/certificates/migrations/0004_certificategenerationhistory.py index e1b496e527..e9168e72a2 100644 --- a/lms/djangoapps/certificates/migrations/0004_certificategenerationhistory.py +++ b/lms/djangoapps/certificates/migrations/0004_certificategenerationhistory.py @@ -5,7 +5,7 @@ from django.db import migrations, models import django.utils.timezone from django.conf import settings import model_utils.fields -import xmodule_django.models +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField class Migration(migrations.Migration): @@ -23,7 +23,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, verbose_name='created', editable=False)), ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, verbose_name='modified', editable=False)), - ('course_id', xmodule_django.models.CourseKeyField(max_length=255)), + ('course_id', CourseKeyField(max_length=255)), ('is_regeneration', models.BooleanField(default=False)), ('generated_by', models.ForeignKey(to=settings.AUTH_USER_MODEL)), ('instructor_task', models.ForeignKey(to='instructor_task.InstructorTask')), diff --git a/lms/djangoapps/certificates/models.py b/lms/djangoapps/certificates/models.py index c61e59eddd..748e84b8bf 100644 --- a/lms/djangoapps/certificates/models.py +++ b/lms/djangoapps/certificates/models.py @@ -68,7 +68,7 @@ from badges.events.course_meta import completion_check, course_group_check from config_models.models import ConfigurationModel from instructor_task.models import InstructorTask from util.milestones_helpers import fulfill_course_milestone, is_prerequisite_courses_enabled -from xmodule_django.models import CourseKeyField, NoneToEmptyManager +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField, NoneToEmptyManager LOGGER = logging.getLogger(__name__) diff --git a/lms/djangoapps/courseware/migrations/0001_initial.py b/lms/djangoapps/courseware/migrations/0001_initial.py index bdd08b0b20..a31fc93be3 100644 --- a/lms/djangoapps/courseware/migrations/0001_initial.py +++ b/lms/djangoapps/courseware/migrations/0001_initial.py @@ -3,9 +3,11 @@ from __future__ import unicode_literals from django.db import migrations, models import model_utils.fields -import xmodule_django.models import django.utils.timezone from django.conf import settings +from openedx.core.djangoapps.xmodule_django.models import ( + CourseKeyField, LocationKeyField, BlockTypeKeyField +) class Migration(migrations.Migration): @@ -19,7 +21,7 @@ class Migration(migrations.Migration): name='OfflineComputedGrade', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('course_id', xmodule_django.models.CourseKeyField(max_length=255, db_index=True)), + ('course_id', CourseKeyField(max_length=255, db_index=True)), ('created', models.DateTimeField(db_index=True, auto_now_add=True, null=True)), ('updated', models.DateTimeField(auto_now=True, db_index=True)), ('gradeset', models.TextField(null=True, blank=True)), @@ -30,7 +32,7 @@ class Migration(migrations.Migration): name='OfflineComputedGradeLog', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('course_id', xmodule_django.models.CourseKeyField(max_length=255, db_index=True)), + ('course_id', CourseKeyField(max_length=255, db_index=True)), ('created', models.DateTimeField(db_index=True, auto_now_add=True, null=True)), ('seconds', models.IntegerField(default=0)), ('nstudents', models.IntegerField(default=0)), @@ -46,8 +48,8 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, verbose_name='created', editable=False)), ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, verbose_name='modified', editable=False)), - ('course_id', xmodule_django.models.CourseKeyField(max_length=255, db_index=True)), - ('location', xmodule_django.models.LocationKeyField(max_length=255, db_index=True)), + ('course_id', CourseKeyField(max_length=255, db_index=True)), + ('location', LocationKeyField(max_length=255, db_index=True)), ('field', models.CharField(max_length=255)), ('value', models.TextField(default=b'null')), ('student', models.ForeignKey(to=settings.AUTH_USER_MODEL)), @@ -58,8 +60,8 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('module_type', models.CharField(default=b'problem', max_length=32, db_index=True, choices=[(b'problem', b'problem'), (b'video', b'video'), (b'html', b'html'), (b'course', b'course'), (b'chapter', b'Section'), (b'sequential', b'Subsection'), (b'library_content', b'Library Content')])), - ('module_state_key', xmodule_django.models.LocationKeyField(max_length=255, db_column=b'module_id', db_index=True)), - ('course_id', xmodule_django.models.CourseKeyField(max_length=255, db_index=True)), + ('module_state_key', LocationKeyField(max_length=255, db_column=b'module_id', db_index=True)), + ('course_id', CourseKeyField(max_length=255, db_index=True)), ('state', models.TextField(null=True, blank=True)), ('grade', models.FloatField(db_index=True, null=True, blank=True)), ('max_grade', models.FloatField(null=True, blank=True)), @@ -103,7 +105,7 @@ class Migration(migrations.Migration): ('value', models.TextField(default=b'null')), ('created', models.DateTimeField(auto_now_add=True, db_index=True)), ('modified', models.DateTimeField(auto_now=True, db_index=True)), - ('module_type', xmodule_django.models.BlockTypeKeyField(max_length=64, db_index=True)), + ('module_type', BlockTypeKeyField(max_length=64, db_index=True)), ('student', models.ForeignKey(to=settings.AUTH_USER_MODEL)), ], ), @@ -115,7 +117,7 @@ class Migration(migrations.Migration): ('value', models.TextField(default=b'null')), ('created', models.DateTimeField(auto_now_add=True, db_index=True)), ('modified', models.DateTimeField(auto_now=True, db_index=True)), - ('usage_id', xmodule_django.models.LocationKeyField(max_length=255, db_index=True)), + ('usage_id', LocationKeyField(max_length=255, db_index=True)), ], ), migrations.AlterUniqueTogether( diff --git a/lms/djangoapps/courseware/models.py b/lms/djangoapps/courseware/models.py index 679697cf88..db2cb7279c 100644 --- a/lms/djangoapps/courseware/models.py +++ b/lms/djangoapps/courseware/models.py @@ -23,7 +23,9 @@ from django.db.models.signals import post_save from model_utils.models import TimeStampedModel import coursewarehistoryextended -from xmodule_django.models import CourseKeyField, LocationKeyField, BlockTypeKeyField +from openedx.core.djangoapps.xmodule_django.models import ( + CourseKeyField, LocationKeyField, BlockTypeKeyField +) log = logging.getLogger("edx.courseware") diff --git a/lms/djangoapps/grades/config/models.py b/lms/djangoapps/grades/config/models.py index c8ed28b23b..dff819d7ed 100644 --- a/lms/djangoapps/grades/config/models.py +++ b/lms/djangoapps/grades/config/models.py @@ -5,7 +5,7 @@ controlling persistent grades. from config_models.models import ConfigurationModel from django.conf import settings from django.db.models import BooleanField -from xmodule_django.models import CourseKeyField +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField class PersistentGradesEnabledFlag(ConfigurationModel): diff --git a/lms/djangoapps/grades/migrations/0001_initial.py b/lms/djangoapps/grades/migrations/0001_initial.py index 20f218dc3f..866db1af13 100644 --- a/lms/djangoapps/grades/migrations/0001_initial.py +++ b/lms/djangoapps/grades/migrations/0001_initial.py @@ -5,7 +5,7 @@ from django.db import migrations, models import coursewarehistoryextended.fields import django.utils.timezone import model_utils.fields -import xmodule_django.models +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField, UsageKeyField class Migration(migrations.Migration): @@ -21,8 +21,8 @@ class Migration(migrations.Migration): ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, verbose_name='modified', editable=False)), ('id', coursewarehistoryextended.fields.UnsignedBigIntAutoField(serialize=False, primary_key=True)), ('user_id', models.IntegerField()), - ('course_id', xmodule_django.models.CourseKeyField(max_length=255)), - ('usage_key', xmodule_django.models.UsageKeyField(max_length=255)), + ('course_id', CourseKeyField(max_length=255)), + ('usage_key', UsageKeyField(max_length=255)), ('subtree_edited_date', models.DateTimeField(verbose_name=b'last content edit timestamp')), ('course_version', models.CharField(max_length=255, verbose_name=b'guid of latest course version', blank=True)), ('earned_all', models.FloatField()), diff --git a/lms/djangoapps/grades/migrations/0003_coursepersistentgradesflag_persistentgradesenabledflag.py b/lms/djangoapps/grades/migrations/0003_coursepersistentgradesflag_persistentgradesenabledflag.py index 161e28e121..b08e0ec0df 100644 --- a/lms/djangoapps/grades/migrations/0003_coursepersistentgradesflag_persistentgradesenabledflag.py +++ b/lms/djangoapps/grades/migrations/0003_coursepersistentgradesflag_persistentgradesenabledflag.py @@ -4,7 +4,7 @@ from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion from django.conf import settings -import xmodule_django.models +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField class Migration(migrations.Migration): @@ -21,7 +21,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('change_date', models.DateTimeField(auto_now_add=True, verbose_name='Change date')), ('enabled', models.BooleanField(default=False, verbose_name='Enabled')), - ('course_id', xmodule_django.models.CourseKeyField(unique=True, max_length=255, db_index=True)), + ('course_id', CourseKeyField(unique=True, max_length=255, db_index=True)), ('changed_by', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='Changed by')), ], ), diff --git a/lms/djangoapps/grades/migrations/0004_visibleblocks_course_id.py b/lms/djangoapps/grades/migrations/0004_visibleblocks_course_id.py index b3fbc72f02..150c0c05ba 100644 --- a/lms/djangoapps/grades/migrations/0004_visibleblocks_course_id.py +++ b/lms/djangoapps/grades/migrations/0004_visibleblocks_course_id.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals from django.db import migrations, models from opaque_keys.edx.keys import CourseKey -import xmodule_django.models +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField class Migration(migrations.Migration): @@ -16,7 +16,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='visibleblocks', name='course_id', - field=xmodule_django.models.CourseKeyField(default=CourseKey.from_string('edX/BerylMonkeys/TNL-5458'), max_length=255, db_index=True), + field=CourseKeyField(default=CourseKey.from_string('edX/BerylMonkeys/TNL-5458'), max_length=255, db_index=True), preserve_default=False, ), ] diff --git a/lms/djangoapps/grades/migrations/0005_multiple_course_flags.py b/lms/djangoapps/grades/migrations/0005_multiple_course_flags.py index e6e8ce1543..3efed916d8 100644 --- a/lms/djangoapps/grades/migrations/0005_multiple_course_flags.py +++ b/lms/djangoapps/grades/migrations/0005_multiple_course_flags.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.db import migrations, models -import xmodule_django.models +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField class Migration(migrations.Migration): @@ -15,6 +15,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='coursepersistentgradesflag', name='course_id', - field=xmodule_django.models.CourseKeyField(max_length=255, db_index=True), + field=CourseKeyField(max_length=255, db_index=True), ), ] diff --git a/lms/djangoapps/grades/migrations/0006_persistent_course_grades.py b/lms/djangoapps/grades/migrations/0006_persistent_course_grades.py index 28f0d46fd4..e0d6ff2d99 100644 --- a/lms/djangoapps/grades/migrations/0006_persistent_course_grades.py +++ b/lms/djangoapps/grades/migrations/0006_persistent_course_grades.py @@ -4,7 +4,7 @@ from __future__ import unicode_literals from django.db import migrations, models import django.utils.timezone import model_utils.fields -import xmodule_django.models +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField import coursewarehistoryextended.fields @@ -22,7 +22,7 @@ class Migration(migrations.Migration): ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, verbose_name='modified', editable=False)), ('id', coursewarehistoryextended.fields.UnsignedBigIntAutoField(serialize=False, primary_key=True)), ('user_id', models.IntegerField(db_index=True)), - ('course_id', xmodule_django.models.CourseKeyField(max_length=255)), + ('course_id', CourseKeyField(max_length=255)), ('course_edited_timestamp', models.DateTimeField(verbose_name='Last content edit timestamp')), ('course_version', models.CharField(max_length=255, verbose_name='Course content version identifier', blank=True)), ('grading_policy_hash', models.CharField(max_length=255, verbose_name='Hash of grading policy')), diff --git a/lms/djangoapps/grades/models.py b/lms/djangoapps/grades/models.py index 634d1b25fc..fcb5a4a26f 100644 --- a/lms/djangoapps/grades/models.py +++ b/lms/djangoapps/grades/models.py @@ -20,7 +20,7 @@ from model_utils.models import TimeStampedModel from coursewarehistoryextended.fields import UnsignedBigIntAutoField from opaque_keys.edx.keys import CourseKey, UsageKey -from xmodule_django.models import CourseKeyField, UsageKeyField +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField, UsageKeyField log = logging.getLogger(__name__) diff --git a/lms/djangoapps/instructor_task/migrations/0001_initial.py b/lms/djangoapps/instructor_task/migrations/0001_initial.py index 487f5a7408..cee53cd2ee 100644 --- a/lms/djangoapps/instructor_task/migrations/0001_initial.py +++ b/lms/djangoapps/instructor_task/migrations/0001_initial.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals from django.db import migrations, models from django.conf import settings -import xmodule_django.models +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField class Migration(migrations.Migration): @@ -18,7 +18,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('task_type', models.CharField(max_length=50, db_index=True)), - ('course_id', xmodule_django.models.CourseKeyField(max_length=255, db_index=True)), + ('course_id', CourseKeyField(max_length=255, db_index=True)), ('task_key', models.CharField(max_length=255, db_index=True)), ('task_input', models.CharField(max_length=255)), ('task_id', models.CharField(max_length=255, db_index=True)), diff --git a/lms/djangoapps/instructor_task/models.py b/lms/djangoapps/instructor_task/models.py index d9321260d4..8179a6c320 100644 --- a/lms/djangoapps/instructor_task/models.py +++ b/lms/djangoapps/instructor_task/models.py @@ -24,7 +24,7 @@ from django.core.files.base import ContentFile from django.db import models, transaction from openedx.core.storage import get_storage -from xmodule_django.models import CourseKeyField +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField # define custom states used by InstructorTask diff --git a/lms/djangoapps/lti_provider/migrations/0001_initial.py b/lms/djangoapps/lti_provider/migrations/0001_initial.py index 575608c946..70ee0ba26d 100644 --- a/lms/djangoapps/lti_provider/migrations/0001_initial.py +++ b/lms/djangoapps/lti_provider/migrations/0001_initial.py @@ -4,7 +4,7 @@ from __future__ import unicode_literals from django.db import migrations, models import provider.utils from django.conf import settings -import xmodule_django.models +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField, UsageKeyField class Migration(migrations.Migration): @@ -18,8 +18,8 @@ class Migration(migrations.Migration): name='GradedAssignment', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('course_key', xmodule_django.models.CourseKeyField(max_length=255, db_index=True)), - ('usage_key', xmodule_django.models.UsageKeyField(max_length=255, db_index=True)), + ('course_key', CourseKeyField(max_length=255, db_index=True)), + ('usage_key', UsageKeyField(max_length=255, db_index=True)), ('lis_result_sourcedid', models.CharField(max_length=255, db_index=True)), ('version_number', models.IntegerField(default=0)), ], diff --git a/lms/djangoapps/lti_provider/models.py b/lms/djangoapps/lti_provider/models.py index 6af85a67ef..34cf9d3492 100644 --- a/lms/djangoapps/lti_provider/models.py +++ b/lms/djangoapps/lti_provider/models.py @@ -12,7 +12,7 @@ from django.contrib.auth.models import User from django.db import models import logging -from xmodule_django.models import CourseKeyField, UsageKeyField +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField, UsageKeyField from provider.utils import short_token diff --git a/lms/djangoapps/notes/migrations/0001_initial.py b/lms/djangoapps/notes/migrations/0001_initial.py index 3d59e81075..9d0627471d 100644 --- a/lms/djangoapps/notes/migrations/0001_initial.py +++ b/lms/djangoapps/notes/migrations/0001_initial.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals from django.db import migrations, models from django.conf import settings -import xmodule_django.models +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField class Migration(migrations.Migration): @@ -17,7 +17,7 @@ class Migration(migrations.Migration): name='Note', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('course_id', xmodule_django.models.CourseKeyField(max_length=255, db_index=True)), + ('course_id', CourseKeyField(max_length=255, db_index=True)), ('uri', models.CharField(max_length=255, db_index=True)), ('text', models.TextField(default=b'')), ('quote', models.TextField(default=b'')), diff --git a/lms/djangoapps/notes/models.py b/lms/djangoapps/notes/models.py index 23bd44e350..4d9a5bdd6f 100644 --- a/lms/djangoapps/notes/models.py +++ b/lms/djangoapps/notes/models.py @@ -5,7 +5,7 @@ from django.core.exceptions import ValidationError from django.utils.html import strip_tags import json -from xmodule_django.models import CourseKeyField +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField class Note(models.Model): diff --git a/lms/djangoapps/shoppingcart/migrations/0001_initial.py b/lms/djangoapps/shoppingcart/migrations/0001_initial.py index dd2b48db7d..e3ca270e3a 100644 --- a/lms/djangoapps/shoppingcart/migrations/0001_initial.py +++ b/lms/djangoapps/shoppingcart/migrations/0001_initial.py @@ -6,7 +6,7 @@ import django.utils.timezone import django.db.models.deletion from django.conf import settings import model_utils.fields -import xmodule_django.models +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField class Migration(migrations.Migration): @@ -23,7 +23,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('code', models.CharField(max_length=32, db_index=True)), ('description', models.CharField(max_length=255, null=True, blank=True)), - ('course_id', xmodule_django.models.CourseKeyField(max_length=255)), + ('course_id', CourseKeyField(max_length=255)), ('percentage_discount', models.IntegerField(default=0)), ('created_at', models.DateTimeField(auto_now_add=True)), ('is_active', models.BooleanField(default=True)), @@ -42,7 +42,7 @@ class Migration(migrations.Migration): name='CourseRegCodeItemAnnotation', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('course_id', xmodule_django.models.CourseKeyField(unique=True, max_length=128, db_index=True)), + ('course_id', CourseKeyField(unique=True, max_length=128, db_index=True)), ('annotation', models.TextField(null=True)), ], ), @@ -51,7 +51,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('code', models.CharField(unique=True, max_length=32, db_index=True)), - ('course_id', xmodule_django.models.CourseKeyField(max_length=255, db_index=True)), + ('course_id', CourseKeyField(max_length=255, db_index=True)), ('created_at', models.DateTimeField(auto_now_add=True)), ('mode_slug', models.CharField(max_length=100, null=True)), ('is_valid', models.BooleanField(default=True)), @@ -90,7 +90,7 @@ class Migration(migrations.Migration): ('zip', models.CharField(max_length=15, null=True)), ('country', models.CharField(max_length=64, null=True)), ('total_amount', models.FloatField()), - ('course_id', xmodule_django.models.CourseKeyField(max_length=255, db_index=True)), + ('course_id', CourseKeyField(max_length=255, db_index=True)), ('internal_reference', models.CharField(help_text='Internal reference code for this invoice.', max_length=255, null=True, blank=True)), ('customer_reference_number', models.CharField(help_text="Customer's reference code for this invoice.", max_length=63, null=True, blank=True)), ('is_valid', models.BooleanField(default=True)), @@ -185,7 +185,7 @@ class Migration(migrations.Migration): name='PaidCourseRegistrationAnnotation', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('course_id', xmodule_django.models.CourseKeyField(unique=True, max_length=128, db_index=True)), + ('course_id', CourseKeyField(unique=True, max_length=128, db_index=True)), ('annotation', models.TextField(null=True)), ], ), @@ -204,7 +204,7 @@ class Migration(migrations.Migration): name='CertificateItem', fields=[ ('orderitem_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='shoppingcart.OrderItem')), - ('course_id', xmodule_django.models.CourseKeyField(max_length=128, db_index=True)), + ('course_id', CourseKeyField(max_length=128, db_index=True)), ('mode', models.SlugField()), ('course_enrollment', models.ForeignKey(to='student.CourseEnrollment')), ], @@ -214,7 +214,7 @@ class Migration(migrations.Migration): name='CourseRegCodeItem', fields=[ ('orderitem_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='shoppingcart.OrderItem')), - ('course_id', xmodule_django.models.CourseKeyField(max_length=128, db_index=True)), + ('course_id', CourseKeyField(max_length=128, db_index=True)), ('mode', models.SlugField(default=b'honor')), ], bases=('shoppingcart.orderitem',), @@ -223,7 +223,7 @@ class Migration(migrations.Migration): name='CourseRegistrationCodeInvoiceItem', fields=[ ('invoiceitem_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='shoppingcart.InvoiceItem')), - ('course_id', xmodule_django.models.CourseKeyField(max_length=128, db_index=True)), + ('course_id', CourseKeyField(max_length=128, db_index=True)), ], bases=('shoppingcart.invoiceitem',), ), @@ -232,7 +232,7 @@ class Migration(migrations.Migration): fields=[ ('orderitem_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='shoppingcart.OrderItem')), ('donation_type', models.CharField(default=b'general', max_length=32, choices=[(b'general', b'A general donation'), (b'course', b'A donation to a particular course')])), - ('course_id', xmodule_django.models.CourseKeyField(max_length=255, db_index=True)), + ('course_id', CourseKeyField(max_length=255, db_index=True)), ], bases=('shoppingcart.orderitem',), ), @@ -240,7 +240,7 @@ class Migration(migrations.Migration): name='PaidCourseRegistration', fields=[ ('orderitem_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='shoppingcart.OrderItem')), - ('course_id', xmodule_django.models.CourseKeyField(max_length=128, db_index=True)), + ('course_id', CourseKeyField(max_length=128, db_index=True)), ('mode', models.SlugField(default=b'honor')), ('course_enrollment', models.ForeignKey(to='student.CourseEnrollment', null=True)), ], diff --git a/lms/djangoapps/shoppingcart/models.py b/lms/djangoapps/shoppingcart/models.py index eb99e9bff2..d3a8200b5a 100644 --- a/lms/djangoapps/shoppingcart/models.py +++ b/lms/djangoapps/shoppingcart/models.py @@ -39,7 +39,7 @@ from course_modes.models import CourseMode from edxmako.shortcuts import render_to_string from student.models import CourseEnrollment, UNENROLL_DONE, EnrollStatusChange from util.query import use_read_replica_if_available -from xmodule_django.models import CourseKeyField +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField from .exceptions import ( InvalidCartItem, PurchasedCallbackException, diff --git a/lms/djangoapps/survey/migrations/0001_initial.py b/lms/djangoapps/survey/migrations/0001_initial.py index 895abfd5d0..1742d1f3fa 100644 --- a/lms/djangoapps/survey/migrations/0001_initial.py +++ b/lms/djangoapps/survey/migrations/0001_initial.py @@ -5,7 +5,7 @@ from django.db import migrations, models import django.utils.timezone from django.conf import settings import model_utils.fields -import xmodule_django.models +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField class Migration(migrations.Migration): @@ -23,7 +23,7 @@ class Migration(migrations.Migration): ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, verbose_name='modified', editable=False)), ('field_name', models.CharField(max_length=255, db_index=True)), ('field_value', models.CharField(max_length=1024)), - ('course_key', xmodule_django.models.CourseKeyField(max_length=255, null=True, db_index=True)), + ('course_key', CourseKeyField(max_length=255, null=True, db_index=True)), ], options={ 'abstract': False, diff --git a/lms/djangoapps/survey/models.py b/lms/djangoapps/survey/models.py index 88b9696364..28b4d91df2 100644 --- a/lms/djangoapps/survey/models.py +++ b/lms/djangoapps/survey/models.py @@ -13,7 +13,7 @@ from model_utils.models import TimeStampedModel from survey.exceptions import SurveyFormNameAlreadyExists, SurveyFormNotFound -from xmodule_django.models import CourseKeyField +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField log = logging.getLogger("edx.survey") diff --git a/lms/djangoapps/teams/migrations/0001_initial.py b/lms/djangoapps/teams/migrations/0001_initial.py index dc6011955b..9cabc5747a 100644 --- a/lms/djangoapps/teams/migrations/0001_initial.py +++ b/lms/djangoapps/teams/migrations/0001_initial.py @@ -5,7 +5,7 @@ from django.db import migrations, models import django_countries.fields from django.conf import settings import student.models -import xmodule_django.models +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField class Migration(migrations.Migration): @@ -22,7 +22,7 @@ class Migration(migrations.Migration): ('team_id', models.CharField(unique=True, max_length=255)), ('discussion_topic_id', models.CharField(unique=True, max_length=255)), ('name', models.CharField(max_length=255, db_index=True)), - ('course_id', xmodule_django.models.CourseKeyField(max_length=255, db_index=True)), + ('course_id', CourseKeyField(max_length=255, db_index=True)), ('topic_id', models.CharField(db_index=True, max_length=255, blank=True)), ('date_created', models.DateTimeField(auto_now_add=True)), ('description', models.CharField(max_length=300)), diff --git a/lms/djangoapps/teams/models.py b/lms/djangoapps/teams/models.py index a7609de278..2c6b7249d0 100644 --- a/lms/djangoapps/teams/models.py +++ b/lms/djangoapps/teams/models.py @@ -23,7 +23,7 @@ from django_comment_common.signals import ( comment_voted, comment_endorsed ) -from xmodule_django.models import CourseKeyField +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField from util.model_utils import slugify from student.models import LanguageField, CourseEnrollment from .errors import AlreadyOnTeamInCourse, NotEnrolledInCourseForTeam, ImmutableMembershipFieldException diff --git a/lms/djangoapps/verified_track_content/migrations/0001_initial.py b/lms/djangoapps/verified_track_content/migrations/0001_initial.py index 0f1df04262..0c6a8f2dc9 100644 --- a/lms/djangoapps/verified_track_content/migrations/0001_initial.py +++ b/lms/djangoapps/verified_track_content/migrations/0001_initial.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.db import migrations, models -import xmodule_django.models +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField class Migration(migrations.Migration): @@ -15,7 +15,7 @@ class Migration(migrations.Migration): name='VerifiedTrackCohortedCourse', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('course_key', xmodule_django.models.CourseKeyField(help_text='The course key for the course we would like to be auto-cohorted.', unique=True, max_length=255, db_index=True)), + ('course_key', CourseKeyField(help_text='The course key for the course we would like to be auto-cohorted.', unique=True, max_length=255, db_index=True)), ('enabled', models.BooleanField()), ], ), diff --git a/lms/djangoapps/verified_track_content/models.py b/lms/djangoapps/verified_track_content/models.py index 20373aa377..fcf7f71131 100644 --- a/lms/djangoapps/verified_track_content/models.py +++ b/lms/djangoapps/verified_track_content/models.py @@ -6,7 +6,7 @@ from django.utils.translation import ugettext_lazy from django.dispatch import receiver from django.db.models.signals import post_save, pre_save -from xmodule_django.models import CourseKeyField +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField from student.models import CourseEnrollment from courseware.courses import get_course_by_id diff --git a/lms/djangoapps/verify_student/migrations/0001_initial.py b/lms/djangoapps/verify_student/migrations/0001_initial.py index ebc698cd64..563a1e2e10 100644 --- a/lms/djangoapps/verify_student/migrations/0001_initial.py +++ b/lms/djangoapps/verify_student/migrations/0001_initial.py @@ -4,10 +4,10 @@ from __future__ import unicode_literals from django.db import migrations, models import lms.djangoapps.verify_student.models import model_utils.fields -import xmodule_django.models import django.db.models.deletion import django.utils.timezone from django.conf import settings +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField class Migration(migrations.Migration): @@ -23,7 +23,7 @@ class Migration(migrations.Migration): ('id', models.IntegerField(verbose_name='ID', db_index=True, auto_created=True, blank=True)), ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, verbose_name='created', editable=False)), ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, verbose_name='modified', editable=False)), - ('course_key', xmodule_django.models.CourseKeyField(help_text='The course for which this deadline applies', max_length=255, db_index=True)), + ('course_key', CourseKeyField(help_text='The course for which this deadline applies', max_length=255, db_index=True)), ('deadline', models.DateTimeField(help_text='The datetime after which users are no longer allowed to submit photos for verification.')), ('history_id', models.AutoField(serialize=False, primary_key=True)), ('history_date', models.DateTimeField()), @@ -66,7 +66,7 @@ class Migration(migrations.Migration): name='SkippedReverification', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('course_id', xmodule_django.models.CourseKeyField(max_length=255, db_index=True)), + ('course_id', CourseKeyField(max_length=255, db_index=True)), ('created_at', models.DateTimeField(auto_now_add=True)), ], ), @@ -101,7 +101,7 @@ class Migration(migrations.Migration): name='VerificationCheckpoint', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('course_id', xmodule_django.models.CourseKeyField(max_length=255, db_index=True)), + ('course_id', CourseKeyField(max_length=255, db_index=True)), ('checkpoint_location', models.CharField(max_length=255)), ('photo_verification', models.ManyToManyField(to='verify_student.SoftwareSecurePhotoVerification')), ], @@ -112,7 +112,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, verbose_name='created', editable=False)), ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, verbose_name='modified', editable=False)), - ('course_key', xmodule_django.models.CourseKeyField(help_text='The course for which this deadline applies', unique=True, max_length=255, db_index=True)), + ('course_key', CourseKeyField(help_text='The course for which this deadline applies', unique=True, max_length=255, db_index=True)), ('deadline', models.DateTimeField(help_text='The datetime after which users are no longer allowed to submit photos for verification.')), ], options={ diff --git a/lms/djangoapps/verify_student/models.py b/lms/djangoapps/verify_student/models.py index e4f1c144eb..8f8d963133 100644 --- a/lms/djangoapps/verify_student/models.py +++ b/lms/djangoapps/verify_student/models.py @@ -44,7 +44,7 @@ from lms.djangoapps.verify_student.ssencrypt import ( ) from xmodule.modulestore.django import modulestore from xmodule.modulestore.exceptions import ItemNotFoundError -from xmodule_django.models import CourseKeyField +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers log = logging.getLogger(__name__) diff --git a/openedx/core/djangoapps/bookmarks/migrations/0001_initial.py b/openedx/core/djangoapps/bookmarks/migrations/0001_initial.py index 114025a3cb..81ebc26d55 100644 --- a/openedx/core/djangoapps/bookmarks/migrations/0001_initial.py +++ b/openedx/core/djangoapps/bookmarks/migrations/0001_initial.py @@ -3,10 +3,10 @@ from __future__ import unicode_literals from django.db import migrations, models import model_utils.fields -import xmodule_django.models import jsonfield.fields import django.utils.timezone from django.conf import settings +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField, LocationKeyField class Migration(migrations.Migration): @@ -22,8 +22,8 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, verbose_name='created', editable=False)), ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, verbose_name='modified', editable=False)), - ('course_key', xmodule_django.models.CourseKeyField(max_length=255, db_index=True)), - ('usage_key', xmodule_django.models.LocationKeyField(max_length=255, db_index=True)), + ('course_key', CourseKeyField(max_length=255, db_index=True)), + ('usage_key', LocationKeyField(max_length=255, db_index=True)), ('_path', jsonfield.fields.JSONField(help_text=b'Path in course tree to the block', db_column=b'path')), ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)), ], @@ -34,8 +34,8 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, verbose_name='created', editable=False)), ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, verbose_name='modified', editable=False)), - ('course_key', xmodule_django.models.CourseKeyField(max_length=255, db_index=True)), - ('usage_key', xmodule_django.models.LocationKeyField(unique=True, max_length=255, db_index=True)), + ('course_key', CourseKeyField(max_length=255, db_index=True)), + ('usage_key', LocationKeyField(unique=True, max_length=255, db_index=True)), ('display_name', models.CharField(default=b'', max_length=255)), ('_paths', jsonfield.fields.JSONField(default=[], help_text=b'All paths in course tree to the corresponding block.', db_column=b'paths')), ], diff --git a/openedx/core/djangoapps/bookmarks/models.py b/openedx/core/djangoapps/bookmarks/models.py index a6b9c1cd88..cbde6bbe70 100644 --- a/openedx/core/djangoapps/bookmarks/models.py +++ b/openedx/core/djangoapps/bookmarks/models.py @@ -13,7 +13,7 @@ from opaque_keys.edx.keys import UsageKey from xmodule.modulestore import search from xmodule.modulestore.django import modulestore from xmodule.modulestore.exceptions import ItemNotFoundError, NoPathToItem -from xmodule_django.models import CourseKeyField, LocationKeyField +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField, LocationKeyField from . import PathItem diff --git a/openedx/core/djangoapps/content/course_overviews/migrations/0001_initial.py b/openedx/core/djangoapps/content/course_overviews/migrations/0001_initial.py index aa310bcc9a..a98cc1d81e 100644 --- a/openedx/core/djangoapps/content/course_overviews/migrations/0001_initial.py +++ b/openedx/core/djangoapps/content/course_overviews/migrations/0001_initial.py @@ -4,7 +4,7 @@ from __future__ import unicode_literals from django.db import migrations, models import django.utils.timezone import model_utils.fields -import xmodule_django.models +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField, UsageKeyField class Migration(migrations.Migration): @@ -19,8 +19,8 @@ class Migration(migrations.Migration): ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, verbose_name='created', editable=False)), ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, verbose_name='modified', editable=False)), ('version', models.IntegerField()), - ('id', xmodule_django.models.CourseKeyField(max_length=255, serialize=False, primary_key=True, db_index=True)), - ('_location', xmodule_django.models.UsageKeyField(max_length=255)), + ('id', CourseKeyField(max_length=255, serialize=False, primary_key=True, db_index=True)), + ('_location', UsageKeyField(max_length=255)), ('display_name', models.TextField(null=True)), ('display_number_with_default', models.TextField()), ('display_org_with_default', models.TextField()), diff --git a/openedx/core/djangoapps/content/course_overviews/models.py b/openedx/core/djangoapps/content/course_overviews/models.py index a16d83fb0d..4b15b17125 100644 --- a/openedx/core/djangoapps/content/course_overviews/models.py +++ b/openedx/core/djangoapps/content/course_overviews/models.py @@ -25,7 +25,7 @@ from xmodule import course_metadata_utils, block_metadata_utils from xmodule.course_module import CourseDescriptor, DEFAULT_START_DATE from xmodule.error_module import ErrorDescriptor from xmodule.modulestore.django import modulestore -from xmodule_django.models import CourseKeyField, UsageKeyField +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField, UsageKeyField log = logging.getLogger(__name__) diff --git a/openedx/core/djangoapps/content/course_overviews/tests.py b/openedx/core/djangoapps/content/course_overviews/tests.py index aa3770b89b..2aebf28053 100644 --- a/openedx/core/djangoapps/content/course_overviews/tests.py +++ b/openedx/core/djangoapps/content/course_overviews/tests.py @@ -398,7 +398,7 @@ class CourseOverviewTestCase(ModuleStoreTestCase): # default value present. So mock it to avoid returning the empty str as primary key # value. Due to empty str, model.save will do an update instead of insert which is # incorrect and get exception in - # common.djangoapps.xmodule_django.models.OpaqueKeyField.get_prep_value + # openedx.core.djangoapps.xmodule_django.models.OpaqueKeyField.get_prep_value with mock.patch('django.db.models.Field.get_pk_value_on_save') as mock_get_pk_value_on_save: mock_get_pk_value_on_save.return_value = None diff --git a/openedx/core/djangoapps/content/course_structures/migrations/0001_initial.py b/openedx/core/djangoapps/content/course_structures/migrations/0001_initial.py index 2ebaf4035c..6946d92cff 100644 --- a/openedx/core/djangoapps/content/course_structures/migrations/0001_initial.py +++ b/openedx/core/djangoapps/content/course_structures/migrations/0001_initial.py @@ -5,7 +5,7 @@ from django.db import migrations, models import django.utils.timezone import model_utils.fields import util.models -import xmodule_django.models +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField class Migration(migrations.Migration): @@ -20,7 +20,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, verbose_name='created', editable=False)), ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, verbose_name='modified', editable=False)), - ('course_id', xmodule_django.models.CourseKeyField(unique=True, max_length=255, verbose_name=b'Course ID', db_index=True)), + ('course_id', CourseKeyField(unique=True, max_length=255, verbose_name=b'Course ID', db_index=True)), ('structure_json', util.models.CompressedTextField(null=True, verbose_name=b'Structure JSON', blank=True)), ('discussion_id_map_json', util.models.CompressedTextField(null=True, verbose_name=b'Discussion ID Map JSON', blank=True)), ], diff --git a/openedx/core/djangoapps/content/course_structures/models.py b/openedx/core/djangoapps/content/course_structures/models.py index 9d59311853..4474e00232 100644 --- a/openedx/core/djangoapps/content/course_structures/models.py +++ b/openedx/core/djangoapps/content/course_structures/models.py @@ -8,7 +8,7 @@ from collections import OrderedDict from model_utils.models import TimeStampedModel from util.models import CompressedTextField -from xmodule_django.models import CourseKeyField, UsageKey +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField, UsageKey logger = logging.getLogger(__name__) # pylint: disable=invalid-name diff --git a/openedx/core/djangoapps/content/course_structures/tests.py b/openedx/core/djangoapps/content/course_structures/tests.py index e640d7d7cc..1a346ca0cb 100644 --- a/openedx/core/djangoapps/content/course_structures/tests.py +++ b/openedx/core/djangoapps/content/course_structures/tests.py @@ -4,13 +4,13 @@ Course Structure Content sub-application test cases import json from nose.plugins.attrib import attr -from xmodule_django.models import UsageKey from xmodule.modulestore.django import SignalHandler from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory from openedx.core.djangoapps.content.course_structures.models import CourseStructure from openedx.core.djangoapps.content.course_structures.signals import listen_for_course_publish from openedx.core.djangoapps.content.course_structures.tasks import _generate_course_structure, update_course_structure +from openedx.core.djangoapps.xmodule_django.models import UsageKey class SignalDisconnectTestMixin(object): diff --git a/openedx/core/djangoapps/course_groups/migrations/0001_initial.py b/openedx/core/djangoapps/course_groups/migrations/0001_initial.py index d1c75181a1..d48ba1f736 100644 --- a/openedx/core/djangoapps/course_groups/migrations/0001_initial.py +++ b/openedx/core/djangoapps/course_groups/migrations/0001_initial.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals from django.db import migrations, models from django.conf import settings -import xmodule_django.models +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField class Migration(migrations.Migration): @@ -17,7 +17,7 @@ class Migration(migrations.Migration): name='CohortMembership', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('course_id', xmodule_django.models.CourseKeyField(max_length=255)), + ('course_id', CourseKeyField(max_length=255)), ], ), migrations.CreateModel( @@ -32,7 +32,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('is_cohorted', models.BooleanField(default=False)), - ('course_id', xmodule_django.models.CourseKeyField(help_text=b'Which course are these settings associated with?', unique=True, max_length=255, db_index=True)), + ('course_id', CourseKeyField(help_text=b'Which course are these settings associated with?', unique=True, max_length=255, db_index=True)), ('_cohorted_discussions', models.TextField(null=True, db_column=b'cohorted_discussions', blank=True)), ('always_cohort_inline_discussions', models.BooleanField(default=True)), ], @@ -42,7 +42,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('name', models.CharField(help_text=b'What is the name of this group? Must be unique within a course.', max_length=255)), - ('course_id', xmodule_django.models.CourseKeyField(help_text=b'Which course is this group associated with?', max_length=255, db_index=True)), + ('course_id', CourseKeyField(help_text=b'Which course is this group associated with?', max_length=255, db_index=True)), ('group_type', models.CharField(max_length=20, choices=[(b'cohort', b'Cohort')])), ('users', models.ManyToManyField(help_text=b'Who is in this group?', related_name='course_groups', to=settings.AUTH_USER_MODEL, db_index=True)), ], diff --git a/openedx/core/djangoapps/course_groups/models.py b/openedx/core/djangoapps/course_groups/models.py index 3c3cad5791..1a74e59d1b 100644 --- a/openedx/core/djangoapps/course_groups/models.py +++ b/openedx/core/djangoapps/course_groups/models.py @@ -11,7 +11,7 @@ from util.db import outer_atomic from django.core.exceptions import ValidationError from django.db.models.signals import pre_delete from django.dispatch import receiver -from xmodule_django.models import CourseKeyField +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField log = logging.getLogger(__name__) diff --git a/openedx/core/djangoapps/credit/migrations/0001_initial.py b/openedx/core/djangoapps/credit/migrations/0001_initial.py index 927845070b..e88df819f3 100644 --- a/openedx/core/djangoapps/credit/migrations/0001_initial.py +++ b/openedx/core/djangoapps/credit/migrations/0001_initial.py @@ -4,12 +4,12 @@ from __future__ import unicode_literals from django.db import migrations, models import openedx.core.djangoapps.credit.models import model_utils.fields -import xmodule_django.models import jsonfield.fields import django.db.models.deletion import django.utils.timezone from django.conf import settings import django.core.validators +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField class Migration(migrations.Migration): @@ -23,7 +23,7 @@ class Migration(migrations.Migration): name='CreditCourse', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('course_key', xmodule_django.models.CourseKeyField(unique=True, max_length=255, db_index=True)), + ('course_key', CourseKeyField(unique=True, max_length=255, db_index=True)), ('enabled', models.BooleanField(default=False)), ], ), diff --git a/openedx/core/djangoapps/credit/models.py b/openedx/core/djangoapps/credit/models.py index ebd1115f1c..0f6695c038 100644 --- a/openedx/core/djangoapps/credit/models.py +++ b/openedx/core/djangoapps/credit/models.py @@ -21,7 +21,7 @@ from jsonfield.fields import JSONField from model_utils.models import TimeStampedModel import pytz from simple_history.models import HistoricalRecords -from xmodule_django.models import CourseKeyField +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField CREDIT_PROVIDER_ID_REGEX = r"[a-z,A-Z,0-9,\-]+" diff --git a/openedx/core/djangoapps/user_api/migrations/0001_initial.py b/openedx/core/djangoapps/user_api/migrations/0001_initial.py index 2945733921..9de3b8c8d5 100644 --- a/openedx/core/djangoapps/user_api/migrations/0001_initial.py +++ b/openedx/core/djangoapps/user_api/migrations/0001_initial.py @@ -6,7 +6,7 @@ import django.utils.timezone from django.conf import settings import model_utils.fields import django.core.validators -import xmodule_django.models +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField class Migration(migrations.Migration): @@ -21,7 +21,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('key', models.CharField(max_length=255, db_index=True)), - ('course_id', xmodule_django.models.CourseKeyField(max_length=255, db_index=True)), + ('course_id', CourseKeyField(max_length=255, db_index=True)), ('value', models.TextField()), ('user', models.ForeignKey(related_name='+', to=settings.AUTH_USER_MODEL)), ], diff --git a/openedx/core/djangoapps/user_api/models.py b/openedx/core/djangoapps/user_api/models.py index 78c65a7fa0..a8e6162cd3 100644 --- a/openedx/core/djangoapps/user_api/models.py +++ b/openedx/core/djangoapps/user_api/models.py @@ -9,7 +9,7 @@ from django.dispatch import receiver from model_utils.models import TimeStampedModel from util.model_utils import get_changed_fields_dict, emit_setting_changed_event -from xmodule_django.models import CourseKeyField +from openedx.core.djangoapps.xmodule_django.models import CourseKeyField # Currently, the "student" app is responsible for # accounts, profiles, enrollments, and the student dashboard. diff --git a/common/djangoapps/xmodule_django/__init__.py b/openedx/core/djangoapps/xmodule_django/__init__.py similarity index 100% rename from common/djangoapps/xmodule_django/__init__.py rename to openedx/core/djangoapps/xmodule_django/__init__.py diff --git a/common/djangoapps/xmodule_django/models.py b/openedx/core/djangoapps/xmodule_django/models.py similarity index 98% rename from common/djangoapps/xmodule_django/models.py rename to openedx/core/djangoapps/xmodule_django/models.py index 854c957876..fe32953342 100644 --- a/common/djangoapps/xmodule_django/models.py +++ b/openedx/core/djangoapps/xmodule_django/models.py @@ -27,7 +27,7 @@ class NoneToEmptyManager(models.Manager): """ Returns the result of NoneToEmptyQuerySet instead of a regular QuerySet. """ - return NoneToEmptyQuerySet(self.model, using=self._db) + return NoneToEmptyQuerySet(self.model, using=self._db) # pylint: disable=no-member class NoneToEmptyQuerySet(models.query.QuerySet): @@ -40,6 +40,7 @@ class NoneToEmptyQuerySet(models.query.QuerySet): empty value. """ def _filter_or_exclude(self, *args, **kwargs): + # pylint: disable=protected-access for name in self.model._meta.get_all_field_names(): field_object, _model, direct, _m2m = self.model._meta.get_field_by_name(name) if direct and hasattr(field_object, 'Empty'):