Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
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)
Ejemplo n.º 3
0
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)