Skip to content

Commit

Permalink
fix: add missing success messages to user and guardian admin actions
Browse files Browse the repository at this point in the history
KK-1186
  • Loading branch information
nikomakela committed Jun 14, 2024
1 parent 7e89c1b commit 21f4e69
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion users/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import markdown
from django import forms
from django.conf import settings
from django.contrib import admin
from django.contrib import admin, messages
from django.contrib.auth import get_user_model
from django.contrib.auth.admin import GroupAdmin as DjangoGroupAdmin
from django.contrib.auth.admin import UserAdmin as DjangoUserAdmin
Expand Down Expand Up @@ -168,6 +168,11 @@ def send_user_auth_service_is_changing_notification(modeladmin, request, queryse
AuthServiceNotificationService.send_user_auth_service_is_changing_notifications(
guardians=queryset, date_of_change_str=None
)
modeladmin.message_user(
request,
_("The notification was sent to the selected guardians."),
messages.SUCCESS,
)


@admin.action(
Expand All @@ -182,6 +187,14 @@ def obsolete_and_send_user_auth_service_is_changing_notification(
AuthServiceNotificationService.send_user_auth_service_is_changing_notifications(
guardians=queryset, date_of_change_str=None, obsolete_handled_users=True
)
modeladmin.message_user(
request,
_(
"The notification was sent to the selected guardians "
"and they are now also obsoleted."
),
messages.SUCCESS,
)


@admin.register(Guardian)
Expand Down Expand Up @@ -250,6 +263,9 @@ def formfield_for_manytomany(self, db_field, request=None, **kwargs):
@admin.action(description="Mark selected users as obsoleted")
def make_obsoleted(modeladmin, request, queryset):
queryset.update(is_obsolete=True)
modeladmin.message_user(
request, _("The selected users are now obsoleted."), messages.SUCCESS
)


@admin.register(get_user_model())
Expand Down

0 comments on commit 21f4e69

Please sign in to comment.