From 962deca5066bc8181c41c54757e51adb32782f33 Mon Sep 17 00:00:00 2001 From: Oskar Hahn Date: Sat, 1 Oct 2016 13:46:16 +0200 Subject: [PATCH] Send full_data through the channel. Saves db queries. --- openslides/utils/collection.py | 6 +++++- tests/unit/utils/test_collection.py | 3 +-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/openslides/utils/collection.py b/openslides/utils/collection.py index 0b4709507..eea1e71db 100644 --- a/openslides/utils/collection.py +++ b/openslides/utils/collection.py @@ -80,8 +80,12 @@ class CollectionElement: 'collection_string': self.collection_string, 'id': self.id, 'deleted': self.is_deleted()} - if self.information is not None: + if self.information: channel_message['information'] = self.information + if self.full_data: + # Do not use the method get_full_data but the attribute, so the + # full_data is not generated. + channel_message['full_data'] = self.full_data return channel_message def as_autoupdate(self, method, *args): diff --git a/tests/unit/utils/test_collection.py b/tests/unit/utils/test_collection.py index 9867e9ee6..b5ae64f3a 100644 --- a/tests/unit/utils/test_collection.py +++ b/tests/unit/utils/test_collection.py @@ -90,8 +90,7 @@ class TestCollectionElement(TestCase): collection_element.as_channels_message(), {'collection_string': 'testmodule/model', 'id': 42, - 'deleted': False, - 'information': {}}) + 'deleted': False}) def test_as_autoupdate_for_user(self): collection_element = collection.CollectionElement.from_values('testmodule/model', 42)