Skip to content

Fields not translated when using QuerySet .values() method #47

Description

@atodorov

Inside Kiwi TCMS we're using the following pattern:

list(
    TestExecutionStatus.objects.filter(**query).values("id", "name", "weight", "icon", "color")
)

This returns the name field untranslated. From my limited experimentation I can tell that vinaigrette VinaigretteDescriptor doesn't seem to be triggered. (At least it doesn't reach the gettext part).

OTOH if I modify my code to look like:

result = []
for status in TestExecutionStatus.objects.filter(**query).distinct():
    result.append({
       "id": status.pk,
       "name": status.name,
       "weight": status.weight,
       "icon": status.icon,
       "color": status.color,
   })

then the values for name field are returned translated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions