def user_mumbles(request, username): try: user = User.objects.get(username=username) mumbles = user.mumble_set.filter(parent=None) serializer = MumbleSerializer(mumbles, many=True) return Response(serializer.data) except Exception as e: return Response({'detail': f'{e}'}, status=status.HTTP_404_NOT_FOUND)
def userMumbles(request, username): user = User.objects.get(username=username) mumbles = user.mumble_set.filter(parent=None) serializer = MumbleSerializer(mumbles, many=True) return Response(serializer.data)
def get_mumble(self, obj): if obj.notification_type == 'mumble': return MumbleSerializer(obj.mumble, many=False).data return None