diff --git a/country/models.py b/country/models.py index 548d54c7..5ef91d29 100644 --- a/country/models.py +++ b/country/models.py @@ -145,8 +145,9 @@ class Country(TranslatableModel): return Webinar.objects.filter(country=self.id).count() def active_cities(self): - - return City.used.active_qs().filter(country=self) + result = list(set(City.used.active_qs().filter(country=self))) + result.sort(key=lambda x:x.name) + return result lang = translation.get_language() #return City.objects.select_related('exposition_city')\ # .filter(exposition_city__city__isnull=False, translations__language_code=lang, country=self).distinct().order_by('translations__name') diff --git a/settings/templatetags/template_filters.py b/settings/templatetags/template_filters.py index fd8050ca..b90f4b5b 100644 --- a/settings/templatetags/template_filters.py +++ b/settings/templatetags/template_filters.py @@ -228,7 +228,10 @@ def without_page(value): @register.filter def note_by_user(obj, user): - return obj.get_note_by_user(user.id) + if obj: + + return obj.get_note_by_user(user.id) + return '' @register.filter def isdigit(value): diff --git a/templates/client/simple_pages/expo_seminar.html b/templates/client/simple_pages/expo_seminar.html index 0409cda1..25cc0032 100644 --- a/templates/client/simple_pages/expo_seminar.html +++ b/templates/client/simple_pages/expo_seminar.html @@ -248,6 +248,9 @@