From b3773d4ace5f9c0df63f931d7aa946d732af0166 Mon Sep 17 00:00:00 2001 From: j Date: Tue, 28 Feb 2017 21:19:26 +0100 Subject: [PATCH] fix missing filters --- pandora/user/models.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pandora/user/models.py b/pandora/user/models.py index dbbb55c2..f86610b0 100644 --- a/pandora/user/models.py +++ b/pandora/user/models.py @@ -387,6 +387,15 @@ def get_ui(user_ui, user=None): tids += add_edits(user.edits.exclude(status="featured"), 'personal') tids += add_edits(user.subscribed_edits.filter(status='public'), 'public') tids += add_edits(edit.models.Edit.objects.filter(status='featured'), 'featured') + + if 'filters' in ui: + filterids = [f['id'] for f in settings.CONFIG['itemKeys'] if f.get('filter')] + ui['filters'] = [f for f in ui['filters'] if f['id'] in filterids] + used = [f['id'] for f in ui['filters']] + unused = [f for f in settings.CONFIG['user']['ui']['filters'] if f['id'] not in used] + while len(ui['filters']) < len(settings.CONFIG['user']['ui']['filters']): + ui['filters'].append(unused.pop()) + return ui def init_user(user, request=None):