diff --git a/openslides/agenda/__init__.py b/openslides/agenda/__init__.py
index 004f26495..c72be1dc6 100644
--- a/openslides/agenda/__init__.py
+++ b/openslides/agenda/__init__.py
@@ -8,7 +8,7 @@
It includes time-management and list of speakers.
- :copyright: (c) 2011-2013 by the OpenSlides team, see AUTHORS.
+ :copyright: (c) 2011–2013 by the OpenSlides team, see AUTHORS.
:license: GNU GPL, see LICENSE for more details.
"""
diff --git a/openslides/agenda/forms.py b/openslides/agenda/forms.py
index 38f4ae81a..783398765 100644
--- a/openslides/agenda/forms.py
+++ b/openslides/agenda/forms.py
@@ -6,7 +6,7 @@
Forms for the agenda app.
- :copyright: 2011, 2012 by OpenSlides team, see AUTHORS.
+ :copyright: 2011–2013 by OpenSlides team, see AUTHORS.
:license: GNU GPL, see LICENSE for more details.
"""
@@ -69,7 +69,7 @@ class AppendSpeakerForm(CssClassMixin, forms.Form):
Checks, that the user is not already on the list.
"""
speaker = self.cleaned_data['speaker']
- if Speaker.objects.filter(person=speaker, item=self.item, time=None).exists():
+ if Speaker.objects.filter(person=speaker, item=self.item, begin_time=None).exists():
raise forms.ValidationError(ugettext_lazy(
'%s is already on the list of speakers.'
% unicode(speaker)))
diff --git a/openslides/agenda/models.py b/openslides/agenda/models.py
index f21886910..37b12f0ee 100644
--- a/openslides/agenda/models.py
+++ b/openslides/agenda/models.py
@@ -6,7 +6,7 @@
Models for the agenda app.
- :copyright: 2011, 2012 by OpenSlides team, see AUTHORS.
+ :copyright: 2011–2013 by OpenSlides team, see AUTHORS.
:license: GNU GPL, see LICENSE for more details.
"""
@@ -157,13 +157,21 @@ class Item(MPTTModel, SlideMixin):
'template': 'projector/AgendaSummary.html',
}
elif config['presentation_argument'] == 'show_list_of_speakers':
- speakers = Speaker.objects.filter(time=None, item=self.pk).order_by('weight')
- old_speakers = Speaker.objects.filter(item=self.pk).exclude(time=None).order_by('time')
+
+ speaker_query = Speaker.objects.filter(item=self)
+
+ coming_speakers = speaker_query.filter(begin_time=None).order_by('weight')
+ old_speakers = speaker_query.exclude(begin_time=None).exclude(end_time=None).order_by('end_time')
+ try:
+ actual_speaker = speaker_query.filter(end_time=None).exclude(begin_time=None).get()
+ except Speaker.DoesNotExist:
+ actual_speaker = None
slice_items = max(0, old_speakers.count()-2)
data = {'title': self.get_title(),
'template': 'projector/agenda_list_of_speaker.html',
- 'speakers': speakers,
- 'old_speakers': old_speakers[slice_items:]}
+ 'coming_speakers': coming_speakers,
+ 'old_speakers': old_speakers[slice_items:],
+ 'actual_speaker': actual_speaker}
elif self.related_sid:
data = self.get_related_slide().slide()
else:
@@ -246,7 +254,7 @@ class Item(MPTTModel, SlideMixin):
class SpeakerManager(models.Manager):
def add(self, person, item):
- if self.filter(person=person, item=item, time=None).exists():
+ if self.filter(person=person, item=item, begin_time=None).exists():
raise OpenSlidesError(_('%(person)s is already on the list of speakers of item %(id)s.') % {'person': person, 'id': item.id})
weight = (self.filter(item=item).aggregate(
models.Max('weight'))['weight__max'] or 0)
@@ -270,9 +278,14 @@ class Speaker(models.Model):
ForeinKey to the AgendaItem to which the person want to speak.
"""
- time = models.DateTimeField(null=True)
+ begin_time = models.DateTimeField(null=True)
"""
- Saves the time, when the speaker has spoken. None, if he has not spoken yet.
+ Saves the time, when the speaker begins to speak. None, if he has not spoken yet.
+ """
+
+ end_time = models.DateTimeField(null=True)
+ """
+ Saves the time, when the speaker ends his speach. None, if he is not finished yet.
"""
weight = models.IntegerField(null=True)
@@ -295,12 +308,26 @@ class Speaker(models.Model):
return reverse('agenda_speaker_delete',
args=[self.item.pk, self.pk])
- def speak(self):
+ def begin_speach(self):
"""
Let the person speak.
- Set the weight to None and the time to now.
+ Set the weight to None and the time to now. If anyone is still
+ speaking, end his speach.
"""
+ try:
+ actual_speaker = Speaker.objects.filter(item=self.item, end_time=None).exclude(begin_time=None).get()
+ except Speaker.DoesNotExist:
+ pass
+ else:
+ actual_speaker.end_speach()
self.weight = None
- self.time = datetime.now()
+ self.begin_time = datetime.now()
+ self.save()
+
+ def end_speach(self):
+ """
+ The speach is finished. Set the time to now.
+ """
+ self.end_time = datetime.now()
self.save()
diff --git a/openslides/agenda/signals.py b/openslides/agenda/signals.py
index 4d9d99527..50ab1ece8 100644
--- a/openslides/agenda/signals.py
+++ b/openslides/agenda/signals.py
@@ -80,7 +80,7 @@ def agenda_list_of_speakers(sender, **kwargs):
# Only show list of speakers on Agenda-Items
return None
clear_projector_cache()
- speakers = Speaker.objects.filter(time=None, item=slide)[:5]
+ speakers = Speaker.objects.filter(begin_time=None, item=slide)[:5]
context = {'speakers': speakers}
return render_to_string('agenda/overlay_speaker_projector.html', context)
diff --git a/openslides/agenda/templates/agenda/view.html b/openslides/agenda/templates/agenda/view.html
index 46ec94e29..aaac1ef1c 100644
--- a/openslides/agenda/templates/agenda/view.html
+++ b/openslides/agenda/templates/agenda/view.html
@@ -77,42 +77,40 @@
{% if old_speakers %}
{% trans "Last speakers" %}:
- {% if old_speakers|length > 1 %}
-