예제 #1
0
파일: views.py 프로젝트: m8ttyB/pontoon
def locale(request, locale, template='locale.html'):
    """Locale view."""
    log.debug("Locale view.")

    # Validate locale
    try:
        l = Locale.objects.get(code__iexact=locale)
    except Locale.DoesNotExist:
        raise Http404

    projects = Project.objects.filter(
        disabled=False, pk__in=Resource.objects.values('project'), locales=l) \
        .order_by("name")

    if not projects:
        messages.error(
            request, "Oops, no projects available for this locale.")
        request.session['translate_error'] = {
            'none': None,
        }
        return HttpResponseRedirect(reverse('pontoon.home'))

    data = {
        'projects': get_projects_with_stats(projects, l),
        'locale': l,
    }

    return render(request, template, data)
예제 #2
0
파일: views.py 프로젝트: ping2ayan/pontoon
def locale(request, locale, template='locale.html'):
    """Locale view."""
    log.debug("Locale view.")

    # Validate locale
    try:
        l = Locale.objects.get(code=locale)
    except Locale.DoesNotExist:
        raise Http404

    projects = Project.objects.filter(
        disabled=False, pk__in=Resource.objects.values('project'), locales=l) \
        .order_by("name")

    if not projects:
        messages.error(
            request, "Oops, no projects available for this locale.")
        request.session['translate_error'] = {
            'none': None,
        }
        return HttpResponseRedirect(reverse('pontoon.home'))

    data = {
        'projects': get_projects_with_stats(projects, l),
        'locale': l,
    }

    return render(request, template, data)
예제 #3
0
파일: views.py 프로젝트: yfdyh000/pontoon
def projects(request, template="projects.html"):
    """Project overview."""
    log.debug("Project overview.")

    projects = Project.objects.filter(disabled=False, resources__isnull=False).distinct().order_by("name")

    data = {"projects": get_projects_with_stats(projects)}

    return render(request, template, data)
예제 #4
0
파일: views.py 프로젝트: amire80/pontoon
def projects(request, template="projects.html"):
    """Project overview."""
    log.debug("Project overview.")

    projects = Project.objects.filter(disabled=False, pk__in=Resource.objects.values("project")).order_by("name")

    data = {"projects": get_projects_with_stats(projects), "url_prefix": "projects"}

    return render(request, template, data)
예제 #5
0
def projects(request):
    """Project overview."""
    projects = (Project.objects.filter(
        disabled=False, resources__isnull=False).select_related(
            'latest_translation').distinct().order_by("name"))

    return render(request, 'projects.html', {
        'projects': get_projects_with_stats(projects),
    })
예제 #6
0
def projects(request):
    """Project overview."""
    projects = (
        Project.objects.available()
        .select_related('latest_translation')
        .order_by("name")
    )

    return render(request, 'projects.html', {
        'projects': get_projects_with_stats(projects),
    })
예제 #7
0
파일: views.py 프로젝트: ping2ayan/pontoon
def projects(request, template='projects.html'):
    """Project overview."""
    log.debug("Project overview.")

    projects = Project.objects.filter(
        disabled=False, pk__in=Resource.objects.values('project')) \
        .order_by("name")

    data = {
        'projects': get_projects_with_stats(projects),
    }

    return render(request, template, data)
예제 #8
0
파일: views.py 프로젝트: m8ttyB/pontoon
def projects(request, template='projects.html'):
    """Project overview."""
    log.debug("Project overview.")

    projects = Project.objects.filter(
        disabled=False, pk__in=Resource.objects.values('project')) \
        .order_by("name")

    data = {
        'projects': get_projects_with_stats(projects),
    }

    return render(request, template, data)
예제 #9
0
파일: views.py 프로젝트: waseem18/pontoon
def projects(request):
    """Project overview."""
    projects = (
        Project.objects
        .filter(disabled=False, resources__isnull=False)
        .select_related('latest_translation')
        .distinct()
        .order_by("name")
    )

    return render(request, 'projects.html', {
        'projects': get_projects_with_stats(projects),
    })
예제 #10
0
파일: views.py 프로젝트: yfdyh000/pontoon
def projects(request, template='projects.html'):
    """Project overview."""
    log.debug("Project overview.")

    projects = Project.objects.filter(
        disabled=False,
        resources__isnull=False,
    ).distinct().order_by("name")

    data = {
        'projects': get_projects_with_stats(projects),
    }

    return render(request, template, data)
예제 #11
0
파일: views.py 프로젝트: imromec/pontoon
def admin(request, template='admin.html'):
    """Admin interface."""
    log.debug("Admin interface.")

    if not request.user.has_perm('base.can_manage'):
        return render(request, '403.html', status=403)

    projects = Project.objects.all().order_by("name")

    data = {
        'projects': get_projects_with_stats(projects),
    }

    return render(request, template, data)
예제 #12
0
def admin(request, template='admin.html'):
    """Admin interface."""
    log.debug("Admin interface.")

    if not request.user.has_perm('base.can_manage'):
        return render(request, '403.html', status=403)

    projects = Project.objects.all().order_by("name")

    data = {
        'projects': get_projects_with_stats(projects),
    }

    return render(request, template, data)
예제 #13
0
def locale(request, locale):
    """Locale view."""
    l = get_object_or_404(Locale, code__iexact=locale)

    projects = Project.objects.filter(
        disabled=False, pk__in=Resource.objects.values('project'), locales=l) \
        .order_by("name")

    if not projects:
        raise Http404

    return render(request, 'locale.html', {
        'projects': get_projects_with_stats(projects, l),
        'locale': l,
    })
예제 #14
0
파일: views.py 프로젝트: waseem18/pontoon
def locale(request, locale):
    """Locale view."""
    l = get_object_or_404(Locale, code__iexact=locale)

    projects = Project.objects.filter(
        disabled=False, pk__in=Resource.objects.values('project'), locales=l) \
        .order_by("name")

    if not projects:
        raise Http404

    return render(request, 'locale.html', {
        'projects': get_projects_with_stats(projects, l),
        'locale': l,
    })
예제 #15
0
파일: views.py 프로젝트: rajul/pontoon
def projects(request, template='projects.html'):
    """Project overview."""
    log.debug("Project overview.")

    projects = (
        Project.objects
        .filter(disabled=False, resources__isnull=False)
        .select_related('latest_translation')
        .distinct()
        .order_by("name")
    )

    data = {
        'projects': get_projects_with_stats(projects),
    }

    return render(request, template, data)
예제 #16
0
def locale(request, locale):
    """Locale view."""
    l = get_object_or_404(Locale, code__iexact=locale)

    projects = (
        Project.objects.available()
        .select_related('latest_translation')
        .order_by("name")
    )

    if not projects:
        raise Http404

    return render(request, 'locale.html', {
        'projects': get_projects_with_stats(projects, l),
        'locale': l,
    })
예제 #17
0
파일: views.py 프로젝트: G33KS44n/pontoon
def locale(request, locale, template="locale.html"):
    """Locale view."""
    log.debug("Locale view.")

    # Validate locale
    l = get_object_or_404(Locale, code__iexact=locale)

    projects = Project.objects.filter(disabled=False, pk__in=Resource.objects.values("project"), locales=l).order_by(
        "name"
    )

    if not projects:
        raise Http404

    data = {"projects": get_projects_with_stats(projects, l), "locale": l}

    return render(request, template, data)
예제 #18
0
파일: views.py 프로젝트: yfdyh000/pontoon
def locale(request, locale, template='locale.html'):
    """Locale view."""
    log.debug("Locale view.")

    # Validate locale
    l = get_object_or_404(Locale, code__iexact=locale)

    projects = Project.objects.filter(
        disabled=False, pk__in=Resource.objects.values('project'), locales=l) \
        .order_by("name")

    if not projects:
        raise Http404

    data = {
        'projects': get_projects_with_stats(projects, l),
        'locale': l,
    }

    return render(request, template, data)
예제 #19
0
파일: views.py 프로젝트: amire80/pontoon
def locale(request, locale, template="locale.html"):
    """Locale view."""
    log.debug("Locale view.")

    # Validate locale
    try:
        l = Locale.objects.get(code__iexact=locale)
    except Locale.DoesNotExist:
        raise Http404

    projects = Project.objects.filter(disabled=False, pk__in=Resource.objects.values("project"), locales=l).order_by(
        "name"
    )

    if not projects:
        messages.error(request, "Oops, no projects available for this locale.")
        request.session["translate_error"] = {"none": None}
        return HttpResponseRedirect(reverse("pontoon.home"))

    data = {"projects": get_projects_with_stats(projects, l), "locale": l, "url_prefix": l.code}

    return render(request, template, data)