From 85f89664e09533a55e2be773a20f2ae2c761a596 Mon Sep 17 00:00:00 2001 From: witold Date: Mon, 27 Feb 2023 13:47:34 +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..512727471 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 db_field == Project.admin.field: + return qs.filter(is_lab_admin=True) + return qs