Skip to content

Commit

Permalink
Add admin actions for easy activation/deactivation of users
Browse files Browse the repository at this point in the history
  • Loading branch information
pktiuk committed Jul 24, 2023
1 parent 2896bec commit dc01e36
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
(<https://github.com/opencv/cvat/pull/6474>)
- \[SDK\] `cvat_sdk.datasets`, a framework-agnostic equivalent of `cvat_sdk.pytorch`
(<https://github.com/opencv/cvat/pull/6428>)
- \[API\] Support for Ground Truth job creation and removal (<https://github.com/opencv/cvat/pull/6204>)
- \[API\] Task quality estimation endpoints (<https://github.com/opencv/cvat/pull/6204>)
- Add admin actions for easy activation/deactivation of users

### Changed
- TDB

### Changed
- TDB
Expand Down
14 changes: 14 additions & 0 deletions cvat/apps/iam/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',)}),)
Expand Down

0 comments on commit dc01e36

Please sign in to comment.