Skip to content

Commit

Permalink
Merge branch 'release/0.3.63' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
erikvw committed Aug 27, 2024
2 parents 62fc325 + 36f9db2 commit 6ffed90
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions edc_sites/admin/site_model_admin_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ def get_list_filter(self, request) -> tuple[str | Type[SimpleListFilter], ...]:
"""
list_filter = super().get_list_filter(request)
list_filter = [x for x in list_filter if x != "site" and x != SiteListFilter]
if self.user_may_view_other_sites(request):
if self.user_may_view_other_sites(request) or self.has_viewallsites_permission(
request
):
try:
index = list_filter.index("created")
except ValueError:
Expand All @@ -86,7 +88,10 @@ def get_list_filter(self, request) -> tuple[str | Type[SimpleListFilter], ...]:
def get_list_display(self, request) -> tuple[str]:
"""Insert `site` after the first column"""
list_display = super().get_list_display(request)
if self.user_may_view_other_sites(request) and "site" not in list_display:
if (
self.user_may_view_other_sites(request)
or self.has_viewallsites_permission(request)
) and "site" not in list_display:
list_display = (list_display[0],) + (self.site_code,) + tuple(list_display[1:])
elif "site" in list_display:
list_display = tuple(
Expand Down

0 comments on commit 6ffed90

Please sign in to comment.