country_n_city_str
This commit is contained in:
SDE
2023-09-05 16:17:01 +03:00
parent 52a0105806
commit 704c44a636
3 changed files with 31 additions and 8 deletions

View File

@@ -74,6 +74,29 @@ class Route(BaseModel):
verbose_name_plural = _(u'Маршруты')
ordering = ('name',)
def from_country_n_city_str(self):
country = 'Неизвестно'
if self.from_city:
city = self.from_city.name
if self.from_city.country:
country = self.from_city.country
else:
city = 'Неизвестно'
return f'{city} / {country}'
def to_country_n_city_str(self):
country = 'Неизвестно'
if self.to_city:
city = self.to_city.name
if self.to_city.country:
country = self.to_city.country
else:
city = 'Неизвестно'
return f'{city} / {country}'
def get_address_points(self):
from ReferenceDataApp.models import Airport, City