You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Wagtail with django-modeltranslation, and ManyToManyField to form taxonomy relationships between pages and snppets with translated title and slug fields.
The SQL output below from django-debug-toolbar shows that a filter performed while the current language is set to French, the slug field is not looked up as slug_fr as expected, and the query fails to return pages related to this term.
Expected: taxonomies_resourcetype"."slug_fr" IN ('articles-de-recherche'))
Actual query (see below for full query): taxonomies_resourcetype"."slug" IN ('articles-de-recherche'))
SELECT ••• FROM "resources_resourcepage" INNER JOIN "wagtailtrans_translatablepage" ON ("resources_resourcepage"."translatablepage_ptr_id" = "wagtailtrans_translatablepage"."translatable_page_ptr_id") INNER JOIN "wagtailcore_page" ON ("wagtailtrans_translatablepage"."translatable_page_ptr_id" = "wagtailcore_page"."id") INNER JOIN "resources_resourcepage_resource_type" ON ("resources_resourcepage"."translatablepage_ptr_id" = "resources_resourcepage_resource_type"."resourcepage_id") INNER JOIN "taxonomies_resourcetype" ON ("resources_resourcepage_resource_type"."resourcetype_id" = "taxonomies_resourcetype"."id") WHERE ("wagtailcore_page"."path"::text LIKE '0001000200020001%' AND "wagtailcore_page"."depth" >= 4 AND NOT ("resources_resourcepage"."translatablepage_ptr_id" = 9) AND "wagtailcore_page"."depth" = 5 AND "wagtailcore_page"."live" AND "taxonomies_resourcetype"."slug" IN ('articles-de-recherche')) ORDER BY "resources_resourcepage"."published_date" DESC
--
I'm using
Wagtail
withdjango-modeltranslation
, and ManyToManyField to form taxonomy relationships between pages and snppets with translatedtitle
andslug
fields.According to the docs, filtering on querysets should use the translated version of the field that I'm filtering on - in this case the
slug
field: https://django-modeltranslation.readthedocs.io/en/latest/usage.html#multilingual-managerThe SQL output below from
django-debug-toolbar
shows that a filter performed while the current language is set to French, theslug
field is not looked up asslug_fr
as expected, and the query fails to return pages related to this term.Expected:
taxonomies_resourcetype"."slug_fr" IN ('articles-de-recherche'))
Actual query (see below for full query):
taxonomies_resourcetype"."slug" IN ('articles-de-recherche'))
My installed versions are:
The text was updated successfully, but these errors were encountered: