Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v2.7.0 #6847

Merged
merged 15 commits into from
Sep 13, 2023
Merged
Prev Previous commit
Next Next commit
Add admin action for easy deactivation of users (#6314)
Minor quality of life improvement which helps managing status of users.
pktiuk authored Sep 11, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 705db7bf7609f006bb6caba8e76ebffd8bc8cea2
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -7,7 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## \[Unreleased\]
### Added
- TDB

- Admin actions for easy activation/deactivation of users (<https://github.com/opencv/cvat/pull/6314>)

### Changed
- TDB
15 changes: 15 additions & 0 deletions cvat/apps/iam/admin.py
Original file line number Diff line number Diff line change
@@ -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')}),
@@ -24,6 +25,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',)}),)