Skip to content

Commit

Permalink
pass site to consent definition in view
Browse files Browse the repository at this point in the history
  • Loading branch information
erikvw committed Mar 8, 2024
1 parent 1f68176 commit 917cca0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions edc_consent/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 2 additions & 1 deletion edc_consent/view_mixins/consent_view_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 917cca0

Please sign in to comment.