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)
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)
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)
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)
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), })
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), })
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)
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), })
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)
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)
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, })
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)
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, })
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)
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)
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)