From 9365d6323c7546743ecbc45509d56a075af6459b Mon Sep 17 00:00:00 2001 From: Angger Date: Tue, 2 Aug 2022 16:20:31 +0700 Subject: [PATCH] save instance after changed field value --- api/views.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/views.py b/api/views.py index 5e27b2b..02a7e77 100644 --- a/api/views.py +++ b/api/views.py @@ -401,6 +401,7 @@ class NotificationViewSet(viewsets.ModelViewSet): def set_read(self, request, pk): notification = Notification.objects.filter(id=pk).first() notification.is_read = True + notification.save() serializer = NotificationSerializer(notification) @@ -410,6 +411,7 @@ class NotificationViewSet(viewsets.ModelViewSet): def set_unread(self, request, pk): notification = Notification.objects.filter(id=pk).first() notification.is_read = False + notification.save() serializer = NotificationSerializer(notification)