Merge pull request #82 from ostcar/stable/1.3.x

fixed changing language on the projector
This commit is contained in:
Oskar Hahn 2013-01-08 14:07:16 -08:00
commit 98f4ec8f2a
4 changed files with 12 additions and 10 deletions

View File

@ -89,9 +89,10 @@ def set_active_slide(sid, argument=None):
def clear_projector_cache(): def clear_projector_cache():
cache.delete('projector_content') for language, __ in settings.LANGUAGES:
cache.delete('projector_scrollcontent') cache.delete('projector_content_' + language)
cache.delete('projector_data') cache.delete('projector_scrollcontent_' + language)
cache.delete('projector_data_' + language)
def register_slidemodel(model, model_name=None, control_template=None, weight=0): def register_slidemodel(model, model_name=None, control_template=None, weight=0):

View File

@ -104,25 +104,26 @@ class Projector(TemplateView, AjaxMixin):
return context return context
def get_ajax_context(self, **kwargs): def get_ajax_context(self, **kwargs):
content = cache.get('projector_content') language = self.request.LANGUAGE_CODE
content = cache.get('projector_content_' + language)
if not content: if not content:
content = render_block_to_string( content = render_block_to_string(
self.get_template_names()[0], self.get_template_names()[0],
'content', self.data) 'content', self.data)
cache.set('projector_content', content, 1) cache.set('projector_content_' + language, content, 1)
scrollcontent = cache.get('projector_scrollcontent') scrollcontent = cache.get('projector_scrollcontent')
if not scrollcontent: if not scrollcontent:
scrollcontent = render_block_to_string( scrollcontent = render_block_to_string(
self.get_template_names()[0], self.get_template_names()[0],
'scrollcontent', self.data) 'scrollcontent', self.data)
cache.set('projector_scrollcontent', scrollcontent, 1) cache.set('projector_scrollcontent_' + language, scrollcontent, 1)
# TODO: do not call the hole data-methode, if we only need some vars # TODO: do not call the hole data-methode, if we only need some vars
data = cache.get('projector_data') data = cache.get('projector_data_' + language)
if not data: if not data:
data = self.data data = self.data
cache.set('projector_data', data) cache.set('projector_data_' + language, data)
# clear cache if countdown is enabled # clear cache if countdown is enabled
if config['countdown_state'] == 'active': if config['countdown_state'] == 'active':
clear_projector_cache() clear_projector_cache()