0

I have a Django app which django-countries. I would like to alter the order of the countries shown based on the user's language. For example if the user is using French, I will bring France, Belgium, Luxumburg, Switzerland etc to the top, whereas if they select German I will bring up Germany, Austria, Switzerland etc.

I can set COUNTRIES_FIRST = ['FR','BE','LU','CH'] within settings, but that ordering is then used for all user languages.

Is there a way to base the order on the user's language?

I have tried modifying the COUNTRIES_FIRST within a view, for example

    if self.administration_instance.study.instrument.language == 'French':
        settings.COUNTRIES_FIRST = ['FR','CH','BE','LU']
    translation.activate(self.user_language)

But this clearly doesn't work

HenryM
  • 5,557
  • 7
  • 49
  • 105

0 Answers0