api: add translation context to statistics choices (#61000)

This commit is contained in:
Valentin Deniaud 2022-01-24 14:14:29 +01:00
parent c29b3fadb4
commit 10ee5c3cc4
1 changed files with 3 additions and 2 deletions

View File

@ -34,6 +34,7 @@ from django.utils.formats import date_format
from django.utils.timezone import localtime, make_aware, now
from django.utils.translation import gettext
from django.utils.translation import gettext_noop as N_
from django.utils.translation import pgettext
from django.utils.translation import ugettext_lazy as _
from django_filters import rest_framework as filters
from rest_framework import permissions
@ -2420,11 +2421,11 @@ class StatisticsList(APIView):
def get(self, request, *args, **kwargs):
categories = Category.objects.all()
category_options = [{'id': '_all', 'label': _('All')}] + [
category_options = [{'id': '_all', 'label': pgettext('categories', 'All')}] + [
{'id': x.slug, 'label': x.label} for x in categories
]
agendas = Agenda.objects.all()
agenda_options = [{'id': '_all', 'label': _('All')}] + [
agenda_options = [{'id': '_all', 'label': pgettext('agendas', 'All')}] + [
{'id': x.slug, 'label': x.label} for x in agendas
]
booking_check_filters = set()