how do i order a the options of a form field by a translated field?
models.py:
class UserProfile(models.Model):
...
country=models.ForeignKey('Country')
class Country(models.Model):
class Translation(multilingual.Translation):
name = models.CharField(max_length=60)
...
template.html:
{# userprofileform is a standard modelform for UserProfile #}
{{ userprofileform.country }}
thank you
edit:
I want the options of the select
field to be ordered by name_de or name_en according to the language:
<!-- English -->
<select>
<option>Afganistan</option>
<option>Austria</option>
<option>Bahamas</option>
</select>
<!-- German (as it is) -->
<select>
<option>Afganistan</option>
<option>Österreich</option>
<option>Bahamas</option>
</select>
<!-- German (as it should be) -->
<select>
<option>Afganistan</option>
<option>Bahamaas</option>
<option>Österreich</option>
</select>