I have a queryset of countries where some of them start with non english characters like "Þ" and "Í", when using order_by they are just shown at the end instead of being sorted properly.
This is the result:
>>> from someapp.models import Country
>>> countries = Country.objects.all().order_by("country")
>>> countries
<QuerySet [<Country: Bandaríkin>, <Country: Bretland>, <Country: Danmörk>, <Country: Kanada>, <Country: Noregur>, <Country: Svíþjóð>, <Country: Ísland>, <Country: Þýskaland>]>
How would I use order_by with a non english alphabet?
Here is the model:
class Country(models.Model):
country = models.CharField(max_length=100, unique=True)
def __str__(self):
return "%s" % (self.country)
class Meta:
ordering = ['country']