コード例 #1
0
def matrix(request, project, component):
    """Matrix view of all strings."""
    obj = get_component(request, project, component)

    show = False
    languages = None
    language_codes = None

    if "lang" in request.GET:
        form = MatrixLanguageForm(obj, request.GET)
        show = form.is_valid()
    else:
        form = MatrixLanguageForm(obj)

    if show:
        languages = Language.objects.filter(code__in=form.cleaned_data["lang"]).order()
        language_codes = ",".join(languages.values_list("code", flat=True))

    return render(
        request,
        "matrix.html",
        {
            "object": obj,
            "project": obj.project,
            "languages": languages,
            "language_codes": language_codes,
            "languages_form": form,
        },
    )
コード例 #2
0
def matrix(request, project, subproject):
    """Matrix view of all strings"""
    obj = get_subproject(request, project, subproject)

    show = False
    languages = None
    language_codes = None

    if 'lang' in request.GET:
        form = MatrixLanguageForm(obj, request.GET)
        show = form.is_valid()
    else:
        form = MatrixLanguageForm(obj)

    if show:
        languages = Language.objects.filter(code__in=form.cleaned_data['lang'])
        language_codes = ','.join(languages.values_list('code', flat=True))

    return render(
        request, 'matrix.html', {
            'object': obj,
            'project': obj.project,
            'languages': languages,
            'language_codes': language_codes,
            'languages_form': form,
        })
コード例 #3
0
def matrix(request, project, subproject):
    """Matrix view of all strings"""
    obj = get_subproject(request, project, subproject)

    show = False
    languages = None
    language_codes = None

    if 'lang' in request.GET:
        form = MatrixLanguageForm(obj, request.GET)
        show = form.is_valid()
    else:
        form = MatrixLanguageForm(obj)

    if show:
        languages = Language.objects.filter(
            code__in=form.cleaned_data['lang']
        )
        language_codes = ','.join(languages.values_list('code', flat=True))

    return render(
        request,
        'matrix.html',
        {
            'object': obj,
            'project': obj.project,
            'languages': languages,
            'language_codes': language_codes,
            'languages_form': form,
        }
    )