PLAT-1942 Handle xmodule_django field deprecations

This commit is contained in:
Jeremy Bowman
2018-02-05 15:05:54 -05:00
parent ffbb0c16ef
commit bf86b3da98
89 changed files with 147 additions and 255 deletions

View File

@@ -4,8 +4,7 @@ from __future__ import unicode_literals
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
from openedx.core.djangoapps.xmodule_django.models import CourseKeyField
from opaque_keys.edx.django.models import CourseKeyField
class Migration(migrations.Migration):

View File

@@ -11,9 +11,9 @@ 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 opaque_keys.edx.django.models import CourseKeyField
from course_action_state.managers import CourseActionStateManager, CourseRerunUIStateManager
from openedx.core.djangoapps.xmodule_django.models import CourseKeyField
class CourseActionState(models.Model):

View File

@@ -3,7 +3,7 @@ from __future__ import unicode_literals
from django.db import migrations, models
from openedx.core.djangoapps.xmodule_django.models import CourseKeyField
from opaque_keys.edx.django.models import CourseKeyField
class Migration(migrations.Migration):

View File

@@ -2,7 +2,7 @@
from __future__ import unicode_literals
from django.db import migrations, models
import openedx.core.djangoapps.xmodule_django.models
from opaque_keys.edx.django.models import CourseKeyField
# This should only be used for migrations that have be verified to have a net-neutral sql
@@ -28,7 +28,7 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='coursemode',
name='course_id',
field=openedx.core.djangoapps.xmodule_django.models.CourseKeyField(max_length=255, db_index=True, verbose_name="Course", db_column='course_id'),
field=CourseKeyField(max_length=255, db_index=True, verbose_name="Course", db_column='course_id'),
),
# Change the field name in Django to match our target field name
migrations.RenameField(

View File

@@ -13,10 +13,10 @@ from django.db import models
from django.db.models import Q
from django.dispatch import receiver
from django.utils.translation import ugettext_lazy as _
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
from opaque_keys.edx.keys import CourseKey
from openedx.core.djangoapps.xmodule_django.models import CourseKeyField
from opaque_keys.edx.django.models import CourseKeyField
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
from openedx.core.djangoapps.request_cache.middleware import RequestCache, ns_request_cached
Mode = namedtuple('Mode',

View File

@@ -3,8 +3,7 @@ from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
from openedx.core.djangoapps.xmodule_django.models import CourseKeyField
from opaque_keys.edx.django.models import CourseKeyField
class Migration(migrations.Migration):

View File

@@ -2,7 +2,7 @@
from __future__ import unicode_literals
from django.db import migrations, models
import openedx.core.djangoapps.xmodule_django.models
from opaque_keys.edx.django.models import CourseKeyField
class Migration(migrations.Migration):
@@ -16,7 +16,7 @@ class Migration(migrations.Migration):
name='CourseDiscussionSettings',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('course_id', openedx.core.djangoapps.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)),
('always_divide_inline_discussions', models.BooleanField(default=False)),
('_divided_discussions', models.TextField(null=True, db_column=b'divided_discussions', blank=True)),
('division_scheme', models.CharField(default=b'none', max_length=20, choices=[(b'none', b'None'), (b'cohort', b'Cohort'), (b'enrollment_track', b'Enrollment Track')])),

View File

@@ -8,9 +8,10 @@ from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.utils.translation import ugettext_noop
from openedx.core.djangoapps.xmodule_django.models import CourseKeyField, NoneToEmptyManager
from opaque_keys.edx.django.models import CourseKeyField
from six import text_type
from openedx.core.djangoapps.xmodule_django.models import NoneToEmptyManager
from student.models import CourseEnrollment
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.exceptions import ItemNotFoundError

View File

@@ -5,7 +5,7 @@ import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
from openedx.core.djangoapps.xmodule_django.models import CourseKeyField
from opaque_keys.edx.django.models import CourseKeyField
class Migration(migrations.Migration):

View File

@@ -7,8 +7,7 @@ from config_models.models import ConfigurationModel
from django.contrib import admin
from django.core.cache import cache
from django.db import models
from openedx.core.djangoapps.xmodule_django.models import CourseKeyField
from opaque_keys.edx.django.models import CourseKeyField
class GlobalStatusMessage(ConfigurationModel):

View File

@@ -6,8 +6,7 @@ import django.utils.timezone
import django_countries.fields
from django.conf import settings
from django.db import migrations, models
from openedx.core.djangoapps.xmodule_django.models import CourseKeyField
from opaque_keys.edx.django.models import CourseKeyField
class Migration(migrations.Migration):

View File

@@ -3,7 +3,7 @@ from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import openedx.core.djangoapps.xmodule_django.models
from opaque_keys.edx.django.models import CourseKeyField
# This should only be used for migrations that have be verified to have a net-neutral sql
@@ -28,12 +28,12 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='courseenrollment',
name='course_id',
field=openedx.core.djangoapps.xmodule_django.models.CourseKeyField(max_length=255, db_index=True, db_column='course_id'),
field=CourseKeyField(max_length=255, db_index=True, db_column='course_id'),
),
migrations.AlterField(
model_name='historicalcourseenrollment',
name='course_id',
field=openedx.core.djangoapps.xmodule_django.models.CourseKeyField(max_length=255, db_index=True, db_column='course_id'),
field=CourseKeyField(max_length=255, db_index=True, db_column='course_id'),
),
# Rename the fields in Django to the new names that we want them to have

View File

@@ -41,6 +41,7 @@ from django_countries.fields import CountryField
from edx_rest_api_client.exceptions import SlumberBaseException
from eventtracking import tracker
from model_utils.models import TimeStampedModel
from opaque_keys.edx.django.models import CourseKeyField
from opaque_keys.edx.keys import CourseKey
from pytz import UTC
from six import text_type
@@ -61,7 +62,7 @@ from enrollment.api import _default_course_mode
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
from openedx.core.djangoapps.request_cache import clear_cache, get_cache
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from openedx.core.djangoapps.xmodule_django.models import CourseKeyField, NoneToEmptyManager
from openedx.core.djangoapps.xmodule_django.models import NoneToEmptyManager
from track import contexts
from util.milestones_helpers import is_entrance_exams_enabled
from util.model_utils import emit_field_changed_events, get_changed_fields_dict

View File

@@ -8,8 +8,8 @@ from abc import ABCMeta, abstractmethod
from collections import defaultdict
from django.contrib.auth.models import User
from opaque_keys.edx.django.models import CourseKeyField
from openedx.core.djangoapps.xmodule_django.models import CourseKeyField
from openedx.core.djangoapps.request_cache import get_cache
from student.models import CourseAccessRole

View File

@@ -7,7 +7,7 @@ from config_models.models import ConfigurationModel
from django.db import models
from django.utils.text import compress_string
from openedx.core.djangoapps.util.model_utils import CreatorMixin
from opaque_keys.edx.django.models import CreatorMixin
logger = logging.getLogger(__name__) # pylint: disable=invalid-name