Fixed list of speakers overlay cache problem

This commit is contained in:
Oskar Hahn 2013-04-22 22:09:09 +02:00
parent a4b671f0ac
commit ba75a34017
3 changed files with 6 additions and 4 deletions

View File

@ -20,7 +20,8 @@ from openslides.config.api import ConfigVariable, ConfigPage
from openslides.projector.signals import projector_overlays from openslides.projector.signals import projector_overlays
from openslides.projector.projector import Overlay from openslides.projector.projector import Overlay
from openslides.projector.api import get_active_slide, get_slide_from_sid from openslides.projector.api import (get_active_slide, get_slide_from_sid,
clear_projector_cache)
from .models import Speaker, Item from .models import Speaker, Item
@ -78,6 +79,7 @@ def agenda_list_of_speakers(sender, **kwargs):
if not isinstance(slide, Item): if not isinstance(slide, Item):
# Only show list of speakers on Agenda-Items # Only show list of speakers on Agenda-Items
return None return None
clear_projector_cache()
speakers = Speaker.objects.filter(time=None, item=slide)[:5] speakers = Speaker.objects.filter(time=None, item=slide)[:5]
context = {'speakers': speakers} context = {'speakers': speakers}
return render_to_string('agenda/overlay_speaker_projector.html', context) return render_to_string('agenda/overlay_speaker_projector.html', context)

View File

@ -22,6 +22,7 @@ from openslides.config.signals import config_signal
from openslides.config.api import ConfigVariable, ConfigPage from openslides.config.api import ConfigVariable, ConfigPage
from .projector import Overlay from .projector import Overlay
from .api import clear_projector_cache
projector_overlays = Signal(providing_args=['request']) projector_overlays = Signal(providing_args=['request'])
@ -116,6 +117,7 @@ def countdown(sender, **kwargs):
seconds = 0 seconds = 0
if seconds == 0: if seconds == 0:
config['countdown_state'] = 'expired' config['countdown_state'] = 'expired'
clear_projector_cache()
return render_to_string('projector/overlay_countdown_projector.html', return render_to_string('projector/overlay_countdown_projector.html',
{'seconds': '%02d:%02d' % (seconds / 60, seconds % 60)}) {'seconds': '%02d:%02d' % (seconds / 60, seconds % 60)})

View File

@ -121,9 +121,7 @@ class Projector(TemplateView, AjaxMixin):
if not data: if not data:
data = self.data data = self.data
cache.set('projector_data', data) cache.set('projector_data', data)
# clear cache if countdown is enabled
if config['countdown_state'] == 'active':
clear_projector_cache()
context = super(Projector, self).get_ajax_context(**kwargs) context = super(Projector, self).get_ajax_context(**kwargs)
content_hash = hash(content) content_hash = hash(content)
context.update({ context.update({