Merge branch '24-Fixing/fixing-read-unread-notification' into 'main'
save instance after changed field value Closes #23 See merge request dev/yuyu!5
This commit is contained in:
commit
651d0f83fb
1 changed files with 2 additions and 0 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue