Skip to content

Commit

Permalink
call func from get_context_data - may override in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
erikvw committed Nov 28, 2024
1 parent 5f8a06d commit 0970666
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion edc_sites/view_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

class SiteViewMixin:
def get_context_data(self, **kwargs) -> dict:
kwargs = self.get_context_data_for_sites(**kwargs)
return super().get_context_data(**kwargs)

def get_context_data_for_sites(self, **kwargs):
try:
site_profile = SiteProfile.objects.get(site__id=self.request.site.id)
except ObjectDoesNotExist:
Expand All @@ -21,4 +25,4 @@ def get_context_data(self, **kwargs) -> dict:
"Unable to determine site profile 'title'. No sites have been registered! "
)
raise
return super().get_context_data(**kwargs)
return kwargs

0 comments on commit 0970666

Please sign in to comment.