From 233edd9fbf728aac92b0b42d711c13e4f5550f54 Mon Sep 17 00:00:00 2001 From: witold Date: Thu, 2 Mar 2023 14:16:25 +0100 Subject: [PATCH] fix: filter admin field in project admin --- lab/admin/project.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lab/admin/project.py b/lab/admin/project.py index b7286448d..7a2b7e95b 100644 --- a/lab/admin/project.py +++ b/lab/admin/project.py @@ -248,3 +248,11 @@ def changelist_view( request, {**(extra_context if extra_context else {}), "title": _("Projects")}, ) + + def get_field_queryset( + self, db: None, db_field, request: Optional[HttpRequest] + ) -> Optional[Any]: + qs = super().get_field_queryset(db, db_field, request) + if qs and db_field == Project.admin.field: + return qs.filter(is_lab_admin=True) + return qs