Don't allow people into the verification flow if they've already been verified

This commit is contained in:
Diana Huang
2013-09-06 17:20:24 -04:00
parent 5ece64433d
commit 238a2d53e3
3 changed files with 28 additions and 2 deletions

View File

@@ -843,6 +843,23 @@ class CourseEnrollment(models.Model):
except cls.DoesNotExist:
return False
@classmethod
def enrollment_mode_for_user(cls, user, course_id):
"""
Returns the enrollment mode for the given user for the given course
`user` is a Django User object
`course_id` is our usual course_id string (e.g. "edX/Test101/2013_Fall)
"""
try:
record = CourseEnrollment.objects.get(user=user, course_id=course_id)
if record.is_active:
return record.mode
else:
return None
except cls.DoesNotExist:
return None
@classmethod
def enrollments_for_user(cls, user):
return CourseEnrollment.objects.filter(user=user, is_active=1)