'Returns `True` if the user is enrolled in a course that starts with
`course_id_partial`. Otherwise, returns False.
Can be used to determine whether a student is enrolled in a course
whose run name is unknown.
`user` is a Django User object. If it hasn\'t been saved yet (no `.id`
attribute), this method will automatically save it before
adding an enrollment for it.
`course_id_partial` (CourseKey) is missing the run component'

@classmethod
def is_enrolled_by_partial(cls, user, course_id_partial):

    assert isinstance(course_id_partial, CourseKey)
    assert (not course_id_partial.run)
    course_key = SlashSeparatedCourseKey(course_id_partial.org, course_id_partial.course, '')
    querystring = unicode(course_key.to_deprecated_string())
    try:
        return cls.objects.filter(user=user, course_id__startswith=querystring, is_active=1).exists()
    except cls.DoesNotExist:
        return False
