Send full_data through the channel.

Saves db queries.
This commit is contained in:
Oskar Hahn 2016-10-01 13:46:16 +02:00
parent 5879702354
commit 962deca506
2 changed files with 6 additions and 3 deletions

View File

@ -80,8 +80,12 @@ class CollectionElement:
'collection_string': self.collection_string, 'collection_string': self.collection_string,
'id': self.id, 'id': self.id,
'deleted': self.is_deleted()} 'deleted': self.is_deleted()}
if self.information is not None: if self.information:
channel_message['information'] = 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 return channel_message
def as_autoupdate(self, method, *args): def as_autoupdate(self, method, *args):

View File

@ -90,8 +90,7 @@ class TestCollectionElement(TestCase):
collection_element.as_channels_message(), collection_element.as_channels_message(),
{'collection_string': 'testmodule/model', {'collection_string': 'testmodule/model',
'id': 42, 'id': 42,
'deleted': False, 'deleted': False})
'information': {}})
def test_as_autoupdate_for_user(self): def test_as_autoupdate_for_user(self):
collection_element = collection.CollectionElement.from_values('testmodule/model', 42) collection_element = collection.CollectionElement.from_values('testmodule/model', 42)