diff --git a/cms/envs/common.py b/cms/envs/common.py index 65e5436113..33be61f1af 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -1127,8 +1127,6 @@ INSTALLED_APPS = [ 'survey.apps.SurveyConfig', 'lms.djangoapps.verify_student.apps.VerifyStudentConfig', 'completion', - # Reference we couldn't get simple_history dependencies working in any other way. Leaving it - 'lms.djangoapps.grades.apps.GradesConfig', # Microsite configuration application 'microsite_configuration', diff --git a/lms/djangoapps/grades/models.py b/lms/djangoapps/grades/models.py index 07e45126d7..b43826e5b0 100644 --- a/lms/djangoapps/grades/models.py +++ b/lms/djangoapps/grades/models.py @@ -14,6 +14,7 @@ from base64 import b64encode from collections import defaultdict, namedtuple from hashlib import sha1 +from django.apps import apps from django.contrib.auth.models import User from django.db import models from django.utils.timezone import now @@ -653,7 +654,12 @@ class PersistentSubsectionGradeOverride(models.Model): possible_graded_override = models.FloatField(null=True, blank=True) _CACHE_NAMESPACE = u"grades.models.PersistentSubsectionGradeOverride" - history = HistoricalRecords() + + # This is necessary because CMS does not install the grades app, but it + # imports this models code. Simple History will attempt to connect to the installed + # model in the grades app, which will fail. + if 'grades' in apps.app_configs: + history = HistoricalRecords() def __unicode__(self): return u', '.join([