From 71c447768db164e2d7f089fb48b4c3405eb2710d Mon Sep 17 00:00:00 2001 From: John Jarvis Date: Tue, 13 May 2014 17:47:52 -0400 Subject: [PATCH] returning enrollment mode for both active and inactive users --- common/djangoapps/student/models.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/djangoapps/student/models.py b/common/djangoapps/student/models.py index 9d8ae8accd..c6e97efe75 100644 --- a/common/djangoapps/student/models.py +++ b/common/djangoapps/student/models.py @@ -871,10 +871,14 @@ class CourseEnrollment(models.Model): `user` is a Django User object `course_id` is our usual course_id string (e.g. "edX/Test101/2013_Fall) + + Returns the mode for both inactive and active users. + Returns None if the courseenrollment record does not exist. """ try: record = CourseEnrollment.objects.get(user=user, course_id=course_id) - if record.is_active: + + if hasattr(record, 'mode'): return record.mode else: return None