From 917cca09bd3b96f996d3432993b35cdd5215c1ee Mon Sep 17 00:00:00 2001 From: erikvw Date: Thu, 7 Mar 2024 21:41:41 -0600 Subject: [PATCH] pass site to consent definition in view --- edc_consent/managers.py | 2 ++ edc_consent/view_mixins/consent_view_mixins.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/edc_consent/managers.py b/edc_consent/managers.py index a242ddb..ecfa476 100644 --- a/edc_consent/managers.py +++ b/edc_consent/managers.py @@ -8,6 +8,8 @@ class ConsentObjectsManager(SearchSlugManager, models.Manager): + use_in_migrations = True + def get_by_natural_key(self, subject_identifier_as_pk): return self.get(subject_identifier_as_pk=subject_identifier_as_pk) diff --git a/edc_consent/view_mixins/consent_view_mixins.py b/edc_consent/view_mixins/consent_view_mixins.py index 4e52894..de75744 100644 --- a/edc_consent/view_mixins/consent_view_mixins.py +++ b/edc_consent/view_mixins/consent_view_mixins.py @@ -46,7 +46,8 @@ def consents(self) -> QuerySet[ConsentLikeModel]: """Returns a Queryset of consents for this subject.""" if not self._consents: self._consents = [] - for cdef in site_consents.get_consent_definitions(): + site = site_sites.get(self.request.site.id) + for cdef in site_consents.get_consent_definitions(site=site): try: obj = cdef.get_consent_for(subject_identifier=self.subject_identifier) except NotConsentedError: