From 2eba1b5122d743bddbdd76531782c5a1561a28cc Mon Sep 17 00:00:00 2001 From: Troy Sankey Date: Mon, 16 Oct 2017 13:29:54 -0400 Subject: [PATCH] Use singular getter function where only one requirement is expected This avoids a fatal error in Django 1.9+ in most scenarios, where this code (before this commit) will no longer result in an implicit __in query. This commit should be a no-op functionally for Django 1.8. More info: https://code.djangoproject.com/ticket/25284 PLAT-1525 --- openedx/core/djangoapps/credit/api/eligibility.py | 2 +- openedx/core/djangoapps/credit/models.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openedx/core/djangoapps/credit/api/eligibility.py b/openedx/core/djangoapps/credit/api/eligibility.py index 6024b27e4e..d497387203 100644 --- a/openedx/core/djangoapps/credit/api/eligibility.py +++ b/openedx/core/djangoapps/credit/api/eligibility.py @@ -297,7 +297,7 @@ def remove_credit_requirement_status(username, course_key, req_namespace, req_na """ # Find the requirement we're trying to remove - req_to_remove = CreditRequirement.get_course_requirements(course_key, namespace=req_namespace, name=req_name) + req_to_remove = CreditRequirement.get_course_requirement(course_key, req_namespace, req_name) # If we can't find the requirement, then the most likely explanation # is that there was a lag removing the credit requirements after the course diff --git a/openedx/core/djangoapps/credit/models.py b/openedx/core/djangoapps/credit/models.py index c9dc535fe1..dda04453f1 100644 --- a/openedx/core/djangoapps/credit/models.py +++ b/openedx/core/djangoapps/credit/models.py @@ -385,7 +385,7 @@ class CreditRequirement(TimeStampedModel): name(str): Name of credit course requirement Returns: - CreditRequirement object if exists + CreditRequirement object if exists, None otherwise. """ try: