From 7f036af42903e965dca622760b356a36262c3fe4 Mon Sep 17 00:00:00 2001 From: Nimisha Asthagiri Date: Wed, 1 Apr 2020 11:28:23 -0400 Subject: [PATCH] Django2 CMSH Router: add clarifying comment --- openedx/core/lib/django_courseware_routers.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openedx/core/lib/django_courseware_routers.py b/openedx/core/lib/django_courseware_routers.py index 52cb384a22..523d097562 100644 --- a/openedx/core/lib/django_courseware_routers.py +++ b/openedx/core/lib/django_courseware_routers.py @@ -53,7 +53,10 @@ class StudentModuleHistoryExtendedRouter(object): """ Manage relations if the model is StudentModuleHistoryExtended. """ - # Allow relation between CSM and CSMH (this cross-database relationship is declared with db_constraint=False). + # Allow relation between CSM and CSMH (this cross-database relationship is declared with db_constraint=False + # so while cross-model relationship is allowed via Django it is not stored as such within the database). + # Note: The order of obj1 and obj2 are based on the parent-child relationship as explained in + # https://github.com/django/django/blob/stable/2.2.x/django/db/models/fields/related_descriptors.py if self._is_csm(obj1) and self._is_csm_h(obj2): return True