|
|
|
|
@ -28,8 +28,9 @@ class ExpoManager(TranslationManager): |
|
|
|
|
def expo_main(self): |
|
|
|
|
lang = translation.get_language() |
|
|
|
|
key = 'expo_main_page_key_%s'%lang |
|
|
|
|
result = cache.get(key) |
|
|
|
|
if not result: |
|
|
|
|
if key in cache: |
|
|
|
|
result = cache.get(key) |
|
|
|
|
else: |
|
|
|
|
result = list(self.language(lang). |
|
|
|
|
select_related('country', 'city', 'place', 'main'). |
|
|
|
|
prefetch_related('tag'). |
|
|
|
|
@ -42,8 +43,9 @@ class ExpoManager(TranslationManager): |
|
|
|
|
def conf_main(self): |
|
|
|
|
lang = translation.get_language() |
|
|
|
|
key = 'conf_main_page_key_%s'%lang |
|
|
|
|
result = cache.get(key) |
|
|
|
|
if not result: |
|
|
|
|
if key in cache: |
|
|
|
|
result = cache.get(key) |
|
|
|
|
else: |
|
|
|
|
result = list(self.language(lang). |
|
|
|
|
select_related('country', 'city', 'place', 'main'). |
|
|
|
|
prefetch_related('tag'). |
|
|
|
|
@ -54,9 +56,6 @@ class ExpoManager(TranslationManager): |
|
|
|
|
return result |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CityManager(TranslationManager): |
|
|
|
|
cache_time = 600 |
|
|
|
|
def all(self): |
|
|
|
|
@ -74,9 +73,9 @@ class CityManager(TranslationManager): |
|
|
|
|
|
|
|
|
|
def expo_cities(self): |
|
|
|
|
lang = translation.get_language() |
|
|
|
|
key = 'used_expo_cities_%s'%lang |
|
|
|
|
cached_cities = cache.get(key) |
|
|
|
|
if cached_cities: |
|
|
|
|
key = 'used_expo_cities_%s' % lang |
|
|
|
|
if key in cache: |
|
|
|
|
cached_cities = cache.get(key) |
|
|
|
|
return cached_cities |
|
|
|
|
else: |
|
|
|
|
from exposition.models import Exposition |
|
|
|
|
@ -87,12 +86,11 @@ class CityManager(TranslationManager): |
|
|
|
|
|
|
|
|
|
def expo_cities_with_count(self): |
|
|
|
|
lang = translation.get_language() |
|
|
|
|
key = 'used_expo_cities_count_%s'%lang |
|
|
|
|
cached_cities = cache.get(key) |
|
|
|
|
if cached_cities: |
|
|
|
|
key = 'used_expo_cities_count_%s' % lang |
|
|
|
|
if key in cache: |
|
|
|
|
cached_cities = cache.get(key) |
|
|
|
|
return cached_cities |
|
|
|
|
else: |
|
|
|
|
|
|
|
|
|
from exposition.models import Exposition |
|
|
|
|
sql = {'expo_count': |
|
|
|
|
"""SELECT COUNT(*) |
|
|
|
|
@ -110,9 +108,9 @@ class CityManager(TranslationManager): |
|
|
|
|
|
|
|
|
|
def conference_cities_with_count(self): |
|
|
|
|
lang = translation.get_language() |
|
|
|
|
key = 'used_conference_cities_count_%s'%lang |
|
|
|
|
cached_cities = cache.get(key) |
|
|
|
|
if cached_cities: |
|
|
|
|
key = 'used_conference_cities_count_%s' % lang |
|
|
|
|
if key in cache: |
|
|
|
|
cached_cities = cache.get(key) |
|
|
|
|
return cached_cities |
|
|
|
|
else: |
|
|
|
|
|
|
|
|
|
@ -131,12 +129,11 @@ class CityManager(TranslationManager): |
|
|
|
|
cache.set(key, cities, self.cache_time) |
|
|
|
|
return cities |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def conference_cities(self): |
|
|
|
|
lang = translation.get_language() |
|
|
|
|
key = 'used_conference_cities_%s'%lang |
|
|
|
|
cached_cities = cache.get(key) |
|
|
|
|
if cached_cities: |
|
|
|
|
if key in cache: |
|
|
|
|
cached_cities = cache.get(key) |
|
|
|
|
return cached_cities |
|
|
|
|
else: |
|
|
|
|
from conference.models import Conference |
|
|
|
|
@ -151,8 +148,8 @@ class CityManager(TranslationManager): |
|
|
|
|
""" |
|
|
|
|
lang = translation.get_language() |
|
|
|
|
key = 'used_cities_%s'%lang |
|
|
|
|
cached_cities = cache.get(key) |
|
|
|
|
if cached_cities: |
|
|
|
|
if key in cache: |
|
|
|
|
cached_cities = cache.get(key) |
|
|
|
|
return cached_cities |
|
|
|
|
else: |
|
|
|
|
from exposition.models import Exposition |
|
|
|
|
|