From dc01e36bf6f7998c7c338ba4fb35aa0157036240 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Kotiuk?= Date: Wed, 14 Jun 2023 10:47:13 +0200 Subject: [PATCH 1/2] Add admin actions for easy activation/deactivation of users --- CHANGELOG.md | 6 ++++++ cvat/apps/iam/admin.py | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d530f6e285e..6c99e0bb7624 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 () - \[SDK\] `cvat_sdk.datasets`, a framework-agnostic equivalent of `cvat_sdk.pytorch` () +- \[API\] Support for Ground Truth job creation and removal () +- \[API\] Task quality estimation endpoints () +- Add admin actions for easy activation/deactivation of users + +### Changed +- TDB ### Changed - TDB diff --git a/cvat/apps/iam/admin.py b/cvat/apps/iam/admin.py index 01a10836e13f..5e05aafd673e 100644 --- a/cvat/apps/iam/admin.py +++ b/cvat/apps/iam/admin.py @@ -24,6 +24,20 @@ class CustomUserAdmin(UserAdmin): }, ), ) + actions = ["user_activate", "user_deactivate"] + + @admin.action( + permissions=["change"], description=_("Mark selected users as active") + ) + def user_activate(self, request, queryset): + queryset.update(is_active=True) + + @admin.action( + permissions=["change"], description=_("Mark selected users as not active") + ) + def user_deactivate(self, request, queryset): + queryset.update(is_active=False) + class CustomGroupAdmin(GroupAdmin): fieldsets = ((None, {'fields': ('name',)}),) From c635bca6a71e24deedab9c1c05a6fde5db60d4cf Mon Sep 17 00:00:00 2001 From: Maria Khrustaleva Date: Fri, 8 Sep 2023 13:43:06 +0200 Subject: [PATCH 2/2] Add is_active to list_display --- cvat/apps/iam/admin.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cvat/apps/iam/admin.py b/cvat/apps/iam/admin.py index 5e05aafd673e..1cfceb19d600 100644 --- a/cvat/apps/iam/admin.py +++ b/cvat/apps/iam/admin.py @@ -8,6 +8,7 @@ from django.utils.translation import gettext_lazy as _ class CustomUserAdmin(UserAdmin): + list_display = ("username", "email", "first_name", "last_name", "is_active", "is_staff") fieldsets = ( (None, {'fields': ('username', 'password')}), (_('Personal info'), {'fields': ('first_name', 'last_name', 'email')}),