Beispiel #1
0
def level_editor(request):
    """ Renders the level editor page.

    **Context**

    ``RequestContext``
    ``blocks``
        Blocks that can be chosen to be played with later on.
        List of :model:`game.Block`.

    **Template:**

    :template:`game/level_editor.html`
    """

    context = {
        "blocks": [block.type for block in available_blocks()],
        "decor":
        get_all_decor(),
        "characters":
        get_all_character(),
        "themes":
        get_all_themes(),
        "cow_level_enabled":
        app_settings.COW_FEATURE_ENABLED,
        "night_mode_feature_enabled":
        str(app_settings.NIGHT_MODE_FEATURE_ENABLED).lower(),
    }

    return render(request, "game/level_editor.html", context=context)
Beispiel #2
0
 def test_list_characters(self):
     url = reverse("character-list")
     superuser = get_superuser()
     self.client.force_authenticate(user=superuser)
     response = self.client.get(url)
     assert_that(response, has_status_code(status.HTTP_200_OK))
     assert_that(response.data, has_length(len(get_all_character())))
Beispiel #3
0
def level_editor(request):
    """ Renders the level editor page.

    **Context**

    ``RequestContext``
    ``blocks``
        Blocks that can be chosen to be played with later on. List of :model:`game.Block`.

    **Template:**

    :template:`game/level_editor.html`
    """

    context = RequestContext(
        request, {
            'blocks':
            available_blocks(),
            'decor':
            get_all_decor(),
            'characters':
            get_all_character(),
            'themes':
            get_all_themes(),
            'cow_level_enabled':
            app_settings.COW_FEATURE_ENABLED,
            'night_mode_feature_enabled':
            str(app_settings.NIGHT_MODE_FEATURE_ENABLED).lower(),
        })
    return render(request, 'game/level_editor.html', context_instance=context)
def level_editor(request):
    """ Renders the level editor page.

    **Context**

    ``RequestContext``
    ``blocks``
        Blocks that can be chosen to be played with later on.
        List of :model:`game.Block`.

    **Template:**

    :template:`game/level_editor.html`
    """

    return render(
        request,
        "game/level_editor.html",
        context={
            "blocks": available_blocks(),
            "decor": get_all_decor(),
            "characters": get_all_character(),
            "themes": get_all_themes(),
            "cow_level_enabled": app_settings.COW_FEATURE_ENABLED,
            "night_mode_feature_enabled": str(
                app_settings.NIGHT_MODE_FEATURE_ENABLED
            ).lower(),
        },
    )
def level_editor(request):
    """ Renders the level editor page.

    **Context**

    ``RequestContext``
    ``blocks``
        Blocks that can be chosen to be played with later on. List of :model:`game.Block`.

    **Template:**

    :template:`game/level_editor.html`
    """

    context = RequestContext(request, {
        'blocks': available_blocks(),
        'decor': get_all_decor(),
        'characters': get_all_character(),
        'themes': get_all_themes(),
        'cow_level_enabled': app_settings.COW_FEATURE_ENABLED,
        'night_mode_feature_enabled': str(app_settings.NIGHT_MODE_FEATURE_ENABLED).lower(),
    })
    return render(request, 'game/level_editor.html', context_instance=context)
 def test_list_characters(self):
     url = reverse("character-list")
     response = self.client.get(url)
     assert_that(response, has_status_code(status.HTTP_200_OK))
     assert_that(response.data, has_length(len(get_all_character())))
Beispiel #7
0
def character_choices():
    from game.character import get_all_character
    return [(character.name, character.name) for character in get_all_character()]
Beispiel #8
0
 def test_list_characters(self):
     url = reverse('character-list')
     response = self.client.get(url)
     assert_that(response, has_status_code(status.HTTP_200_OK))
     assert_that(response.data, has_length(len(get_all_character())))
Beispiel #9
0
def character_list(request, format=None):
    characters = get_all_character()
    data = [{get_characters_url(i.pk, request)} for i in characters]
    return Response(data)
Beispiel #10
0
def character_list(request, format=None):
    characters = get_all_character()
    data = [{get_characters_url(i.pk, request)} for i in characters]
    return Response(data)