robcharlwood/django-mothertongue — Issue #5: Showing the translated value of a field in admin site instead of the original
Author: vitalie-schiopu
Created: 2011-11-12 16:15:49+00:00
State: open

Hi,

I’ve used this application for a website and after putting it in production I noticed a wrong behavior that might need a correction.

The website supports English and French, English being the default and setup language. I’ll illustrate the problem on the GenericPage model example. (http://packages.python.org/django-mothertongue/usage.html). I create an instance of that model from the admin page with the corresponding French translation. On the site the correct values are showed of the page depending on the browser settings or the url. I can also easily modify the content of the page from the admin site. My browser has English as the preferred language. Everything is fine at this point. Now a colleague, who has French locale set in his browser, connects to the admin site to modify the page I previously created. The interface is in French as expected, but when he gets to the change form of the GenericPage instance, both the original fields and the translation inline have the same values. If he saves the changes, the default English fields are overwritten as well as the inline. Then, if we configure another language, the Russian for example, the administrator who’ll have Russian locale will see the Russian values in the original form and two inlines, Russian and French, but never the English as expected. The only way to solve this is to always manually change the URL to English (en), losing the translated admin site, which is not very inconvenient and error prone.

Would there be a quick fix to this? As the only thoughts I could think of was to in a way to override the ModelAdmin.change_view() to force the retrieval of the correct values or make some custom processing on the Middleware level.

Thanks in advance for any help.

Cheers,