feat: Allow marking notifications as read
This commit is contained in:
@@ -315,6 +315,20 @@ def report_detail_success(request, report_id):
|
||||
|
||||
|
||||
def user_detail(request, user_id):
|
||||
if request.method == "POST":
|
||||
action = request.POST.get("action")
|
||||
if action == "notification_mark_read":
|
||||
notification_id = request.POST.get("notification_id")
|
||||
print(notification_id)
|
||||
notification = BaseNotification.objects.get(pk=notification_id)
|
||||
notification.read = True
|
||||
notification.save()
|
||||
elif action == "notification_mark_all_read":
|
||||
notifications = BaseNotification.objects.filter(user=request.user, mark_read=False)
|
||||
for notification in notifications:
|
||||
notification.read = True
|
||||
notification.save()
|
||||
|
||||
user = User.objects.get(id=user_id)
|
||||
context = {"user": user,
|
||||
"adoption_notices": AdoptionNotice.objects.filter(created_by=user),
|
||||
|
Reference in New Issue
Block a user