Answer the question
In order to leave comments, you need to log in
How to store (and search) cities in different languages in django?
It is required to store in the base of the city (whether there will be a link to the country is still unknown, the city is actually important). You need to store in Russian and English (and in the future also in others). How to implement storage so that it is possible to find a city by name in any language?
One option comes to mind:
class City(models.Model):
lat = models.FloatField()
lon = models.FloatField()
class CityName(models.Model):
city = models.ForeignKey('City', on_delete=models.CASCADE),
name = models.CharField(max_length=128)
lanuage = models.CharField(max_length=8)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question