diff --git a/RoutesApp/models.py b/RoutesApp/models.py index 7631e11..4efc563 100644 --- a/RoutesApp/models.py +++ b/RoutesApp/models.py @@ -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 diff --git a/templates/widgets/w_carrier_card.html b/templates/widgets/w_carrier_card.html index 43f005c..8e6fd59 100644 --- a/templates/widgets/w_carrier_card.html +++ b/templates/widgets/w_carrier_card.html @@ -11,12 +11,12 @@