Skip to content

Commit

Permalink
fix: filter admin field in project admin
Browse files Browse the repository at this point in the history
  • Loading branch information
wiwski committed Feb 27, 2023
1 parent 1bb3c73 commit 85f8966
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lab/admin/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 85f8966

Please sign in to comment.