def levelblock_list(request, level, format=None): blocks = LevelBlock.objects.filter(level__id=level) serializer = LevelBlockSerializer(blocks, many=True, context={"request": request}) return Response(serializer.data)
def levelblock_detail(request, pk, format=None): try: levelblock = LevelBlock.objects.get(pk=pk) except LevelBlock.DoesNotExist: return HttpResponse(status=404) serializer = LevelBlockSerializer(levelblock, context={'request': request}) return Response(serializer.data)
def levelblock_for_level(request, pk, format=None): levelblocks = LevelBlock.objects.filter(level__id=pk) serializer = LevelBlockSerializer(levelblocks, many=True, context={'request': request}) return Response(serializer.data)