Django modeltranslation queries fallback doesn't work

328 views Asked by At

I am using django modeltranslation to build a multi-language site.

Slug fields are also translated. Let's consider to have a Page model with a slug field, which is registered for translation. Every Page has an url that ends with its slug. Printing the slug within a template, fallback works well. So, assuming that only the english slug is set, if the active language is German, it will print the url with the english slug. This is ok.

When searching for that page in the view, using something like

 get_object_or_404(Page, slug = slug)

raises 404 if the German slug is not set, and doesn't fallback to english.

How can I make fallback work also on queries?

Thanks for your help.

0

There are 0 answers