Merge pull request #1395 from normanjaeckel/Fix1394
Fixed bug. Projector was not updated when an object was deleted.
This commit is contained in:
commit
dac781d8aa
File diff suppressed because it is too large
Load Diff
@ -5,7 +5,7 @@
|
|||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2014-10-16 23:27+0200\n"
|
"POT-Creation-Date: 2015-01-11 19:03+0100\n"
|
||||||
"Language: en\n"
|
"Language: en\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
@ -77,7 +77,7 @@ def setup_motion_config(sender, **kwargs):
|
|||||||
|
|
||||||
motion_amendments_prefix = ConfigVariable(
|
motion_amendments_prefix = ConfigVariable(
|
||||||
name='motion_amendments_prefix',
|
name='motion_amendments_prefix',
|
||||||
default_value=pgettext('Prefix for amendment', 'A'),
|
default_value=pgettext('Prefix for the identifier for amendments', 'A'),
|
||||||
form_field=forms.CharField(
|
form_field=forms.CharField(
|
||||||
required=False,
|
required=False,
|
||||||
label=ugettext_lazy('Prefix for the identifier for amendments')))
|
label=ugettext_lazy('Prefix for the identifier for amendments')))
|
||||||
|
@ -61,11 +61,16 @@ class SlideMixin(object):
|
|||||||
|
|
||||||
def delete(self, *args, **kwargs):
|
def delete(self, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
Updates the projector, if the object is on the projector and is deleted.
|
Updates the projector if the object is on the projector and is deleted.
|
||||||
"""
|
"""
|
||||||
from openslides.projector.api import update_projector
|
from openslides.projector.api import update_projector
|
||||||
|
# Checking active slide has to be done before calling super().delete()
|
||||||
|
# because super().delete() deletes the object and than we have no
|
||||||
|
# access to the former existing primary key any more. But updating
|
||||||
|
# projector has to be done after deleting the object of course.
|
||||||
|
update_required = self.is_active_slide()
|
||||||
value = super(SlideMixin, self).delete(*args, **kwargs)
|
value = super(SlideMixin, self).delete(*args, **kwargs)
|
||||||
if self.is_active_slide():
|
if update_required:
|
||||||
update_projector()
|
update_projector()
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
11
tests/projector/models.py
Normal file
11
tests/projector/models.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
from django.db import models
|
||||||
|
|
||||||
|
from openslides.projector.models import SlideMixin
|
||||||
|
|
||||||
|
|
||||||
|
class DummySlideMixinModel(SlideMixin, models.Model):
|
||||||
|
"""
|
||||||
|
Dummy model to test the SlideMixin.
|
||||||
|
"""
|
||||||
|
slide_callback_name = 'dummy_slides_mixin_model_geu3AiceeG9eo6ohChoD'
|
||||||
|
title = models.CharField(max_length=255)
|
17
tests/projector/test_models.py
Normal file
17
tests/projector/test_models.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
from mock import patch
|
||||||
|
|
||||||
|
from openslides.config.api import config
|
||||||
|
from openslides.utils.test import TestCase
|
||||||
|
|
||||||
|
from .models import DummySlideMixinModel
|
||||||
|
|
||||||
|
|
||||||
|
class TestSlideMixin(TestCase):
|
||||||
|
@patch('openslides.projector.api.update_projector')
|
||||||
|
def test_delete(self, mock_update_projector):
|
||||||
|
obj = DummySlideMixinModel.objects.create(title='title_cah4AhZai3einoh9koo3')
|
||||||
|
config['projector_active_slide'] = {
|
||||||
|
'callback': 'dummy_slides_mixin_model_geu3AiceeG9eo6ohChoD',
|
||||||
|
'pk': '1'}
|
||||||
|
obj.delete()
|
||||||
|
mock_update_projector.assert_called_with()
|
@ -29,6 +29,7 @@ DATABASES = {
|
|||||||
# Add OpenSlides plugins to this list
|
# Add OpenSlides plugins to this list
|
||||||
INSTALLED_PLUGINS = (
|
INSTALLED_PLUGINS = (
|
||||||
'tests.person_api',
|
'tests.person_api',
|
||||||
|
'tests.projector',
|
||||||
'tests.utils',
|
'tests.utils',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user