From 687738ff46f228ccb9d02086bfa8b0d139d9bc57 Mon Sep 17 00:00:00 2001 From: j Date: Thu, 15 Nov 2018 10:28:30 +0000 Subject: [PATCH 1/9] make sure settings are dicts --- pandora/clip/managers.py | 6 +++- pandora/clip/views.py | 2 +- pandora/edit/models.py | 63 ++++++++++++++++++++++------------------ pandora/settings.py | 7 +++++ pandora/user/views.py | 2 +- requirements.txt | 1 + update.py | 3 ++ 7 files changed, 53 insertions(+), 31 deletions(-) diff --git a/pandora/clip/managers.py b/pandora/clip/managers.py index d69fb7c6..729624d5 100644 --- a/pandora/clip/managers.py +++ b/pandora/clip/managers.py @@ -145,7 +145,11 @@ class ClipManager(Manager): keys = layer_ids + ['annotations', 'text', '*'] conditions = data.get('query', {}).get('conditions', []) conditions = flatten_conditions(conditions) - conditions = list(filter(lambda c: c.get('key') in keys, conditions)) + conditions_ = [] + for c in conditions: + if c.get('key') in keys and c not in conditions_: + conditions_.append(c) + conditions = conditions_ operator = data.get('query', {}).get('operator', '&') def parse(condition): diff --git a/pandora/clip/views.py b/pandora/clip/views.py index b37427c2..df2c9103 100644 --- a/pandora/clip/views.py +++ b/pandora/clip/views.py @@ -95,7 +95,7 @@ def findClips(request, data): if 'keys' in data: qs = order_query(qs, query['sort']) qs = qs[query['range'][0]:query['range'][1]] - qs = qs.select_related('item') + #qs = qs.select_related('item') layers = settings.CONFIG['layers'] entity_layer_ids = [k['id'] for k in layers if k['type'] == 'entity'] diff --git a/pandora/edit/models.py b/pandora/edit/models.py index 2dfe2ee0..a407d69a 100644 --- a/pandora/edit/models.py +++ b/pandora/edit/models.py @@ -11,9 +11,10 @@ import tempfile from six.moves.urllib.parse import quote import ox from django.conf import settings +from django.contrib.auth import get_user_model +from django.core.cache import cache from django.db import models, transaction from django.db.models import Max -from django.contrib.auth import get_user_model from django.utils.encoding import python_2_unicode_compatible from oxdjango.fields import JSONField @@ -118,7 +119,7 @@ class Edit(models.Model): c = self.add_clip(data) if c: ids.insert(index, c.id) - added.append(c.json(user)) + added.append(c.json(user=user)) added[-1]['index'] = index index += 1 else: @@ -488,32 +489,38 @@ class Clip(models.Model): self.sortvolume = 0 def json(self, user=None): - data = { - 'id': self.get_id(), - 'index': self.index, - 'volume': self.volume, - } - if self.annotation: - data['annotation'] = self.annotation.public_id - data['item'] = self.item.public_id - data['in'] = self.annotation.start - data['out'] = self.annotation.end - data['parts'] = self.annotation.item.cache['parts'] - data['durations'] = self.annotation.item.cache['durations'] - else: - data['item'] = self.item.public_id - data['in'] = self.start - data['out'] = self.end - data['parts'] = self.item.cache['parts'] - data['durations'] = self.item.cache['durations'] - for key in ('title', 'director', 'year', 'videoRatio'): - value = self.item.cache.get(key) - if value: - data[key] = value - data['duration'] = data['out'] - data['in'] - data['cuts'] = tuple([c for c in self.item.get('cuts', []) if c > self.start and c < self.end]) - data['layers'] = self.get_layers(user) - data['streams'] = [s.file.oshash for s in self.item.streams()] + cache_key = 'edit:clip:' + str(self.get_id()) + if user: + cache_key += ':' + user.username + data = cache.get(cache_key) + if not data: + data = { + 'id': self.get_id(), + 'index': self.index, + 'volume': self.volume, + } + if self.annotation: + data['annotation'] = self.annotation.public_id + data['item'] = self.item.public_id + data['in'] = self.annotation.start + data['out'] = self.annotation.end + data['parts'] = self.annotation.item.cache['parts'] + data['durations'] = self.annotation.item.cache['durations'] + else: + data['item'] = self.item.public_id + data['in'] = self.start + data['out'] = self.end + data['parts'] = self.item.cache['parts'] + data['durations'] = self.item.cache['durations'] + for key in ('title', 'director', 'year', 'videoRatio'): + value = self.item.cache.get(key) + if value: + data[key] = value + data['duration'] = data['out'] - data['in'] + data['cuts'] = tuple([c for c in self.item.get('cuts', []) if c > self.start and c < self.end]) + data['layers'] = self.get_layers(user) + data['streams'] = [s.file.oshash for s in self.item.streams()] + cache.set(cache_key, data, 180) return data def get_annotations(self): diff --git a/pandora/settings.py b/pandora/settings.py index a8e59fed..4f24c8fc 100644 --- a/pandora/settings.py +++ b/pandora/settings.py @@ -170,6 +170,13 @@ LOGGING = { } } +CACHES = { + 'default': { + 'BACKEND': 'django.core.cache.backends.db.DatabaseCache', + 'LOCATION': 'cache', + } +} + AUTH_PROFILE_MODULE = 'user.UserProfile' AUTH_CHECK_USERNAME = True FFMPEG = 'ffmpeg' diff --git a/pandora/user/views.py b/pandora/user/views.py index 17ce76da..d9639d70 100644 --- a/pandora/user/views.py +++ b/pandora/user/views.py @@ -785,7 +785,7 @@ def setUI(request, data): if isinstance(p, list): p = p[getPositionById(p, key)] else: - if key not in p: + if key not in p or not isinstance(p[key], dict): p[key] = {} p = p[key] if value == None and keys[0] in p: diff --git a/requirements.txt b/requirements.txt index a3936b66..a3b5c98f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,3 +10,4 @@ requests==2.19.1 tornado<5 geoip2==2.9.0 youtube-dl +python-memcached diff --git a/update.py b/update.py index 72ad1db8..e5a41f06 100755 --- a/update.py +++ b/update.py @@ -249,6 +249,9 @@ if __name__ == "__main__": update_service('pandora-tasks') if old < 5975: run('./bin/pip', 'install', '-r', 'requirements.txt') + if old <= 6064: + run('./bin/pip', 'install', '-r', 'requirements.txt') + run('./pandora/manage.py', 'createcachetable') else: if len(sys.argv) == 1: release = get_release() From 4512b010c6c728e9c4b8b2e7d6c4551323b95b92 Mon Sep 17 00:00:00 2001 From: j Date: Thu, 15 Nov 2018 10:28:51 +0000 Subject: [PATCH 2/9] undo --- pandora/clip/managers.py | 6 +--- pandora/clip/views.py | 2 +- pandora/edit/models.py | 63 ++++++++++++++++++---------------------- pandora/settings.py | 7 ----- pandora/user/views.py | 2 +- requirements.txt | 1 - update.py | 3 -- 7 files changed, 31 insertions(+), 53 deletions(-) diff --git a/pandora/clip/managers.py b/pandora/clip/managers.py index 729624d5..d69fb7c6 100644 --- a/pandora/clip/managers.py +++ b/pandora/clip/managers.py @@ -145,11 +145,7 @@ class ClipManager(Manager): keys = layer_ids + ['annotations', 'text', '*'] conditions = data.get('query', {}).get('conditions', []) conditions = flatten_conditions(conditions) - conditions_ = [] - for c in conditions: - if c.get('key') in keys and c not in conditions_: - conditions_.append(c) - conditions = conditions_ + conditions = list(filter(lambda c: c.get('key') in keys, conditions)) operator = data.get('query', {}).get('operator', '&') def parse(condition): diff --git a/pandora/clip/views.py b/pandora/clip/views.py index df2c9103..b37427c2 100644 --- a/pandora/clip/views.py +++ b/pandora/clip/views.py @@ -95,7 +95,7 @@ def findClips(request, data): if 'keys' in data: qs = order_query(qs, query['sort']) qs = qs[query['range'][0]:query['range'][1]] - #qs = qs.select_related('item') + qs = qs.select_related('item') layers = settings.CONFIG['layers'] entity_layer_ids = [k['id'] for k in layers if k['type'] == 'entity'] diff --git a/pandora/edit/models.py b/pandora/edit/models.py index a407d69a..2dfe2ee0 100644 --- a/pandora/edit/models.py +++ b/pandora/edit/models.py @@ -11,10 +11,9 @@ import tempfile from six.moves.urllib.parse import quote import ox from django.conf import settings -from django.contrib.auth import get_user_model -from django.core.cache import cache from django.db import models, transaction from django.db.models import Max +from django.contrib.auth import get_user_model from django.utils.encoding import python_2_unicode_compatible from oxdjango.fields import JSONField @@ -119,7 +118,7 @@ class Edit(models.Model): c = self.add_clip(data) if c: ids.insert(index, c.id) - added.append(c.json(user=user)) + added.append(c.json(user)) added[-1]['index'] = index index += 1 else: @@ -489,38 +488,32 @@ class Clip(models.Model): self.sortvolume = 0 def json(self, user=None): - cache_key = 'edit:clip:' + str(self.get_id()) - if user: - cache_key += ':' + user.username - data = cache.get(cache_key) - if not data: - data = { - 'id': self.get_id(), - 'index': self.index, - 'volume': self.volume, - } - if self.annotation: - data['annotation'] = self.annotation.public_id - data['item'] = self.item.public_id - data['in'] = self.annotation.start - data['out'] = self.annotation.end - data['parts'] = self.annotation.item.cache['parts'] - data['durations'] = self.annotation.item.cache['durations'] - else: - data['item'] = self.item.public_id - data['in'] = self.start - data['out'] = self.end - data['parts'] = self.item.cache['parts'] - data['durations'] = self.item.cache['durations'] - for key in ('title', 'director', 'year', 'videoRatio'): - value = self.item.cache.get(key) - if value: - data[key] = value - data['duration'] = data['out'] - data['in'] - data['cuts'] = tuple([c for c in self.item.get('cuts', []) if c > self.start and c < self.end]) - data['layers'] = self.get_layers(user) - data['streams'] = [s.file.oshash for s in self.item.streams()] - cache.set(cache_key, data, 180) + data = { + 'id': self.get_id(), + 'index': self.index, + 'volume': self.volume, + } + if self.annotation: + data['annotation'] = self.annotation.public_id + data['item'] = self.item.public_id + data['in'] = self.annotation.start + data['out'] = self.annotation.end + data['parts'] = self.annotation.item.cache['parts'] + data['durations'] = self.annotation.item.cache['durations'] + else: + data['item'] = self.item.public_id + data['in'] = self.start + data['out'] = self.end + data['parts'] = self.item.cache['parts'] + data['durations'] = self.item.cache['durations'] + for key in ('title', 'director', 'year', 'videoRatio'): + value = self.item.cache.get(key) + if value: + data[key] = value + data['duration'] = data['out'] - data['in'] + data['cuts'] = tuple([c for c in self.item.get('cuts', []) if c > self.start and c < self.end]) + data['layers'] = self.get_layers(user) + data['streams'] = [s.file.oshash for s in self.item.streams()] return data def get_annotations(self): diff --git a/pandora/settings.py b/pandora/settings.py index 4f24c8fc..a8e59fed 100644 --- a/pandora/settings.py +++ b/pandora/settings.py @@ -170,13 +170,6 @@ LOGGING = { } } -CACHES = { - 'default': { - 'BACKEND': 'django.core.cache.backends.db.DatabaseCache', - 'LOCATION': 'cache', - } -} - AUTH_PROFILE_MODULE = 'user.UserProfile' AUTH_CHECK_USERNAME = True FFMPEG = 'ffmpeg' diff --git a/pandora/user/views.py b/pandora/user/views.py index d9639d70..17ce76da 100644 --- a/pandora/user/views.py +++ b/pandora/user/views.py @@ -785,7 +785,7 @@ def setUI(request, data): if isinstance(p, list): p = p[getPositionById(p, key)] else: - if key not in p or not isinstance(p[key], dict): + if key not in p: p[key] = {} p = p[key] if value == None and keys[0] in p: diff --git a/requirements.txt b/requirements.txt index a3b5c98f..a3936b66 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,4 +10,3 @@ requests==2.19.1 tornado<5 geoip2==2.9.0 youtube-dl -python-memcached diff --git a/update.py b/update.py index e5a41f06..72ad1db8 100755 --- a/update.py +++ b/update.py @@ -249,9 +249,6 @@ if __name__ == "__main__": update_service('pandora-tasks') if old < 5975: run('./bin/pip', 'install', '-r', 'requirements.txt') - if old <= 6064: - run('./bin/pip', 'install', '-r', 'requirements.txt') - run('./pandora/manage.py', 'createcachetable') else: if len(sys.argv) == 1: release = get_release() From 3e14795d0bdb3120ff566ba31f2ff668f051249e Mon Sep 17 00:00:00 2001 From: j Date: Thu, 15 Nov 2018 10:29:14 +0000 Subject: [PATCH 3/9] make sure settings are dicts --- pandora/user/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora/user/views.py b/pandora/user/views.py index 17ce76da..d9639d70 100644 --- a/pandora/user/views.py +++ b/pandora/user/views.py @@ -785,7 +785,7 @@ def setUI(request, data): if isinstance(p, list): p = p[getPositionById(p, key)] else: - if key not in p: + if key not in p or not isinstance(p[key], dict): p[key] = {} p = p[key] if value == None and keys[0] in p: From f4aa94f848e21020ff5ae87fd50784a64f3a4e05 Mon Sep 17 00:00:00 2001 From: j Date: Thu, 15 Nov 2018 10:30:17 +0000 Subject: [PATCH 4/9] enable cache backend --- pandora/settings.py | 7 +++++++ requirements.txt | 1 + update.py | 3 +++ 3 files changed, 11 insertions(+) diff --git a/pandora/settings.py b/pandora/settings.py index a8e59fed..4f24c8fc 100644 --- a/pandora/settings.py +++ b/pandora/settings.py @@ -170,6 +170,13 @@ LOGGING = { } } +CACHES = { + 'default': { + 'BACKEND': 'django.core.cache.backends.db.DatabaseCache', + 'LOCATION': 'cache', + } +} + AUTH_PROFILE_MODULE = 'user.UserProfile' AUTH_CHECK_USERNAME = True FFMPEG = 'ffmpeg' diff --git a/requirements.txt b/requirements.txt index a3936b66..a3b5c98f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,3 +10,4 @@ requests==2.19.1 tornado<5 geoip2==2.9.0 youtube-dl +python-memcached diff --git a/update.py b/update.py index 72ad1db8..e5a41f06 100755 --- a/update.py +++ b/update.py @@ -249,6 +249,9 @@ if __name__ == "__main__": update_service('pandora-tasks') if old < 5975: run('./bin/pip', 'install', '-r', 'requirements.txt') + if old <= 6064: + run('./bin/pip', 'install', '-r', 'requirements.txt') + run('./pandora/manage.py', 'createcachetable') else: if len(sys.argv) == 1: release = get_release() From 72bb3ba6c106722ad07c3dc298a37aa2aaaf523f Mon Sep 17 00:00:00 2001 From: j Date: Thu, 15 Nov 2018 11:17:29 +0000 Subject: [PATCH 5/9] item should only be loaded if item is joined, disable for now --- pandora/clip/managers.py | 6 +++- pandora/clip/views.py | 2 +- pandora/edit/models.py | 63 ++++++++++++++++++++++------------------ 3 files changed, 41 insertions(+), 30 deletions(-) diff --git a/pandora/clip/managers.py b/pandora/clip/managers.py index d69fb7c6..729624d5 100644 --- a/pandora/clip/managers.py +++ b/pandora/clip/managers.py @@ -145,7 +145,11 @@ class ClipManager(Manager): keys = layer_ids + ['annotations', 'text', '*'] conditions = data.get('query', {}).get('conditions', []) conditions = flatten_conditions(conditions) - conditions = list(filter(lambda c: c.get('key') in keys, conditions)) + conditions_ = [] + for c in conditions: + if c.get('key') in keys and c not in conditions_: + conditions_.append(c) + conditions = conditions_ operator = data.get('query', {}).get('operator', '&') def parse(condition): diff --git a/pandora/clip/views.py b/pandora/clip/views.py index b37427c2..df2c9103 100644 --- a/pandora/clip/views.py +++ b/pandora/clip/views.py @@ -95,7 +95,7 @@ def findClips(request, data): if 'keys' in data: qs = order_query(qs, query['sort']) qs = qs[query['range'][0]:query['range'][1]] - qs = qs.select_related('item') + #qs = qs.select_related('item') layers = settings.CONFIG['layers'] entity_layer_ids = [k['id'] for k in layers if k['type'] == 'entity'] diff --git a/pandora/edit/models.py b/pandora/edit/models.py index 2dfe2ee0..a407d69a 100644 --- a/pandora/edit/models.py +++ b/pandora/edit/models.py @@ -11,9 +11,10 @@ import tempfile from six.moves.urllib.parse import quote import ox from django.conf import settings +from django.contrib.auth import get_user_model +from django.core.cache import cache from django.db import models, transaction from django.db.models import Max -from django.contrib.auth import get_user_model from django.utils.encoding import python_2_unicode_compatible from oxdjango.fields import JSONField @@ -118,7 +119,7 @@ class Edit(models.Model): c = self.add_clip(data) if c: ids.insert(index, c.id) - added.append(c.json(user)) + added.append(c.json(user=user)) added[-1]['index'] = index index += 1 else: @@ -488,32 +489,38 @@ class Clip(models.Model): self.sortvolume = 0 def json(self, user=None): - data = { - 'id': self.get_id(), - 'index': self.index, - 'volume': self.volume, - } - if self.annotation: - data['annotation'] = self.annotation.public_id - data['item'] = self.item.public_id - data['in'] = self.annotation.start - data['out'] = self.annotation.end - data['parts'] = self.annotation.item.cache['parts'] - data['durations'] = self.annotation.item.cache['durations'] - else: - data['item'] = self.item.public_id - data['in'] = self.start - data['out'] = self.end - data['parts'] = self.item.cache['parts'] - data['durations'] = self.item.cache['durations'] - for key in ('title', 'director', 'year', 'videoRatio'): - value = self.item.cache.get(key) - if value: - data[key] = value - data['duration'] = data['out'] - data['in'] - data['cuts'] = tuple([c for c in self.item.get('cuts', []) if c > self.start and c < self.end]) - data['layers'] = self.get_layers(user) - data['streams'] = [s.file.oshash for s in self.item.streams()] + cache_key = 'edit:clip:' + str(self.get_id()) + if user: + cache_key += ':' + user.username + data = cache.get(cache_key) + if not data: + data = { + 'id': self.get_id(), + 'index': self.index, + 'volume': self.volume, + } + if self.annotation: + data['annotation'] = self.annotation.public_id + data['item'] = self.item.public_id + data['in'] = self.annotation.start + data['out'] = self.annotation.end + data['parts'] = self.annotation.item.cache['parts'] + data['durations'] = self.annotation.item.cache['durations'] + else: + data['item'] = self.item.public_id + data['in'] = self.start + data['out'] = self.end + data['parts'] = self.item.cache['parts'] + data['durations'] = self.item.cache['durations'] + for key in ('title', 'director', 'year', 'videoRatio'): + value = self.item.cache.get(key) + if value: + data[key] = value + data['duration'] = data['out'] - data['in'] + data['cuts'] = tuple([c for c in self.item.get('cuts', []) if c > self.start and c < self.end]) + data['layers'] = self.get_layers(user) + data['streams'] = [s.file.oshash for s in self.item.streams()] + cache.set(cache_key, data, 180) return data def get_annotations(self): From c039279984696d3fc059ce72b7a9cf4052f2ba27 Mon Sep 17 00:00:00 2001 From: j Date: Thu, 15 Nov 2018 11:17:48 +0000 Subject: [PATCH 6/9] revert --- pandora/clip/managers.py | 6 +--- pandora/clip/views.py | 2 +- pandora/edit/models.py | 63 ++++++++++++++++++---------------------- 3 files changed, 30 insertions(+), 41 deletions(-) diff --git a/pandora/clip/managers.py b/pandora/clip/managers.py index 729624d5..d69fb7c6 100644 --- a/pandora/clip/managers.py +++ b/pandora/clip/managers.py @@ -145,11 +145,7 @@ class ClipManager(Manager): keys = layer_ids + ['annotations', 'text', '*'] conditions = data.get('query', {}).get('conditions', []) conditions = flatten_conditions(conditions) - conditions_ = [] - for c in conditions: - if c.get('key') in keys and c not in conditions_: - conditions_.append(c) - conditions = conditions_ + conditions = list(filter(lambda c: c.get('key') in keys, conditions)) operator = data.get('query', {}).get('operator', '&') def parse(condition): diff --git a/pandora/clip/views.py b/pandora/clip/views.py index df2c9103..b37427c2 100644 --- a/pandora/clip/views.py +++ b/pandora/clip/views.py @@ -95,7 +95,7 @@ def findClips(request, data): if 'keys' in data: qs = order_query(qs, query['sort']) qs = qs[query['range'][0]:query['range'][1]] - #qs = qs.select_related('item') + qs = qs.select_related('item') layers = settings.CONFIG['layers'] entity_layer_ids = [k['id'] for k in layers if k['type'] == 'entity'] diff --git a/pandora/edit/models.py b/pandora/edit/models.py index a407d69a..2dfe2ee0 100644 --- a/pandora/edit/models.py +++ b/pandora/edit/models.py @@ -11,10 +11,9 @@ import tempfile from six.moves.urllib.parse import quote import ox from django.conf import settings -from django.contrib.auth import get_user_model -from django.core.cache import cache from django.db import models, transaction from django.db.models import Max +from django.contrib.auth import get_user_model from django.utils.encoding import python_2_unicode_compatible from oxdjango.fields import JSONField @@ -119,7 +118,7 @@ class Edit(models.Model): c = self.add_clip(data) if c: ids.insert(index, c.id) - added.append(c.json(user=user)) + added.append(c.json(user)) added[-1]['index'] = index index += 1 else: @@ -489,38 +488,32 @@ class Clip(models.Model): self.sortvolume = 0 def json(self, user=None): - cache_key = 'edit:clip:' + str(self.get_id()) - if user: - cache_key += ':' + user.username - data = cache.get(cache_key) - if not data: - data = { - 'id': self.get_id(), - 'index': self.index, - 'volume': self.volume, - } - if self.annotation: - data['annotation'] = self.annotation.public_id - data['item'] = self.item.public_id - data['in'] = self.annotation.start - data['out'] = self.annotation.end - data['parts'] = self.annotation.item.cache['parts'] - data['durations'] = self.annotation.item.cache['durations'] - else: - data['item'] = self.item.public_id - data['in'] = self.start - data['out'] = self.end - data['parts'] = self.item.cache['parts'] - data['durations'] = self.item.cache['durations'] - for key in ('title', 'director', 'year', 'videoRatio'): - value = self.item.cache.get(key) - if value: - data[key] = value - data['duration'] = data['out'] - data['in'] - data['cuts'] = tuple([c for c in self.item.get('cuts', []) if c > self.start and c < self.end]) - data['layers'] = self.get_layers(user) - data['streams'] = [s.file.oshash for s in self.item.streams()] - cache.set(cache_key, data, 180) + data = { + 'id': self.get_id(), + 'index': self.index, + 'volume': self.volume, + } + if self.annotation: + data['annotation'] = self.annotation.public_id + data['item'] = self.item.public_id + data['in'] = self.annotation.start + data['out'] = self.annotation.end + data['parts'] = self.annotation.item.cache['parts'] + data['durations'] = self.annotation.item.cache['durations'] + else: + data['item'] = self.item.public_id + data['in'] = self.start + data['out'] = self.end + data['parts'] = self.item.cache['parts'] + data['durations'] = self.item.cache['durations'] + for key in ('title', 'director', 'year', 'videoRatio'): + value = self.item.cache.get(key) + if value: + data[key] = value + data['duration'] = data['out'] - data['in'] + data['cuts'] = tuple([c for c in self.item.get('cuts', []) if c > self.start and c < self.end]) + data['layers'] = self.get_layers(user) + data['streams'] = [s.file.oshash for s in self.item.streams()] return data def get_annotations(self): From 83765d91d8e2d63494890f11cc09832ab491d11f Mon Sep 17 00:00:00 2001 From: j Date: Thu, 15 Nov 2018 11:18:00 +0000 Subject: [PATCH 7/9] item should only be loaded if item is joined, disable for now --- pandora/clip/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora/clip/views.py b/pandora/clip/views.py index b37427c2..df2c9103 100644 --- a/pandora/clip/views.py +++ b/pandora/clip/views.py @@ -95,7 +95,7 @@ def findClips(request, data): if 'keys' in data: qs = order_query(qs, query['sort']) qs = qs[query['range'][0]:query['range'][1]] - qs = qs.select_related('item') + #qs = qs.select_related('item') layers = settings.CONFIG['layers'] entity_layer_ids = [k['id'] for k in layers if k['type'] == 'entity'] From 68b2482ede5b6a76fe366198af728efc6ec71517 Mon Sep 17 00:00:00 2001 From: j Date: Thu, 15 Nov 2018 11:18:26 +0000 Subject: [PATCH 8/9] avoid duplicated keys in nested queries --- pandora/clip/managers.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pandora/clip/managers.py b/pandora/clip/managers.py index d69fb7c6..729624d5 100644 --- a/pandora/clip/managers.py +++ b/pandora/clip/managers.py @@ -145,7 +145,11 @@ class ClipManager(Manager): keys = layer_ids + ['annotations', 'text', '*'] conditions = data.get('query', {}).get('conditions', []) conditions = flatten_conditions(conditions) - conditions = list(filter(lambda c: c.get('key') in keys, conditions)) + conditions_ = [] + for c in conditions: + if c.get('key') in keys and c not in conditions_: + conditions_.append(c) + conditions = conditions_ operator = data.get('query', {}).get('operator', '&') def parse(condition): From 092c1b318412ad57673d67373f84d58f97cddaf2 Mon Sep 17 00:00:00 2001 From: j Date: Thu, 15 Nov 2018 11:21:07 +0000 Subject: [PATCH 9/9] followup to dc0132a913: fix check for panel --- static/js/filterForm.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/js/filterForm.js b/static/js/filterForm.js index d6e85ca2..2240876b 100644 --- a/static/js/filterForm.js +++ b/static/js/filterForm.js @@ -100,7 +100,7 @@ pandora.ui.filterForm = function(options) { id: list.id, query: that.$filter.options('value') }, function(result) { - editPanel.updatePanel && pandora.$ui.editPanel.updatePanel(); + pandora.$ui.editPanel && pandora.$ui.editPanel.updatePanel(); }); } else { pandora.$ui.list && pandora.$ui.list