deschler / django-modeltranslation

Translates Django models using a registration approach.
BSD 3-Clause "New" or "Revised" License
1.34k stars 257 forks source link

Columns for all languages are added to table #704

Closed stephan0h closed 9 months ago

stephan0h commented 9 months ago

We took a first dive to django-modeltranslation yesterday and we had one problem: we coulnd't prevent it from creating columns for all available languages on our table. Of course we did set the language in settings.py:

    LANGUAGES = [
        ('en', _('English')),
        ('de', _('German')),
    ]
    LANGUAGE_CODE = 'de'

    MODELTRANSLATION_LANGUAGES = ('en', 'de')
    MODELTRANSLATION_DEFAULT_LANGUAGE = 'en'
    MODELTRANSLATION_PREPOPULATE_LANGUAGE = 'en'
    MODELTRANSLATION_FALLBACK_LANGUAGES = ('en', 'de')
    MODELTRANSLATION_TRANSLATION_FILES = (
        'salesUnit.translation',
    )

How can we correct this behaviour?

last-partizan commented 9 months ago

Hi Try creating a repository with minimal repdocution of this bug. It looks like your setting aren't getting loaded.

stephan0h commented 9 months ago

ok, will do. Coming back on this ...

stephan0h commented 9 months ago

Problem is solved apparently. For whatever reason we had the following line in our settings.py:

from modeltranslation import settings as modeltranslation_settings

Removing it solved it :-)