diff --git a/signbank/dictionary/adminviews.py b/signbank/dictionary/adminviews.py index f4bb9c74a..a5b4e1212 100755 --- a/signbank/dictionary/adminviews.py +++ b/signbank/dictionary/adminviews.py @@ -14,7 +14,7 @@ QueryDict, JsonResponse, StreamingHttpResponse from django.urls import reverse_lazy from django.core.exceptions import PermissionDenied, ObjectDoesNotExist -from django.utils.translation import override, gettext_lazy as _, activate +from django.utils.translation import override, gettext, gettext_lazy as _, activate from django.shortcuts import * from django.contrib import messages from django.contrib.sites.models import Site @@ -6539,7 +6539,7 @@ def get_context_data(self, **kwargs): context['available_tags'] = [tag for tag in Tag.objects.all()] - similar_gloss_fields = ['handedness', 'domhndsh', 'subhndsh', 'locprim', 'movSh'] + similar_gloss_fields = ['handedness', 'domhndsh', 'subhndsh', 'locprim', 'movSh', 'repeat'] context['similar_gloss_fields'] = json.dumps(similar_gloss_fields) similar_gloss_fields_labels = {} for field in similar_gloss_fields: @@ -6573,6 +6573,10 @@ def get_context_data(self, **kwargs): field='MovementShape', machine_value__gt=1).order_by('name')] context['available_movSh'] = available_movSh + available_boolean = [{'machine_value': 1, 'name': gettext("Yes")}, + {'machine_value': 0, 'name': gettext("No")}] + context['available_boolean'] = available_boolean + context['query_parameters'] = json.dumps(self.query_parameters) query_parameters_keys = list(self.query_parameters.keys()) context['query_parameters_keys'] = json.dumps(query_parameters_keys) diff --git a/signbank/dictionary/templates/dictionary/admin_batch_edit_view.html b/signbank/dictionary/templates/dictionary/admin_batch_edit_view.html index 09dc27947..57d6e384f 100644 --- a/signbank/dictionary/templates/dictionary/admin_batch_edit_view.html +++ b/signbank/dictionary/templates/dictionary/admin_batch_edit_view.html @@ -504,6 +504,15 @@
+ {% for ab in available_boolean %} + + {% endfor %} +
++ | {% load field_choice %} {% for fieldname, label in similar_gloss_fields_labels.items %} {% with gloss|get_gloss_field:fieldname as fieldvalue %} diff --git a/signbank/dictionary/templatetags/field_choice.py b/signbank/dictionary/templatetags/field_choice.py index 2ad0fd56c..edde71adc 100644 --- a/signbank/dictionary/templatetags/field_choice.py +++ b/signbank/dictionary/templatetags/field_choice.py @@ -1,5 +1,7 @@ from django.template import Library from signbank.dictionary.models import FieldChoice, Dataset +from django.utils.translation import gettext + def get_field_choice(machine_value,field_category): @@ -17,9 +19,9 @@ def get_field_choice(machine_value,field_category): return '-' - register = Library() + @register.filter def normalise_empty(machine_value): if machine_value in [None,'None']: @@ -39,7 +41,12 @@ def translated_frequency_list(dataset): @register.filter def get_gloss_field(gloss, field): field_value = getattr(gloss, field) - if field_value: + if field in ['repeat', 'altern']: + if not field_value: + return gettext("No") + else: + return gettext("Yes") + elif field_value: return field_value.name else: return '-' |