How come it is not possible to save the entry when I fetch it by using filter?
It works if I fetch it with get.
I need to use filter since I’m using the serializer to return a JSON object. And Django’s serializer doesn’t like if it is not a QuerySet.
message = UserMessage.objects.filter(id=request.GET['msg_id'])
message[0].read = True
message[0].save()
Unless the
messageis evaluated and thus cached, themessage[0]always hits DB, for exampleyou could assign it to variable
or use
updatedirectly, as jpic suggested: