From fd496dfee02c7a65eea730f0051c8b678a7aac40 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 22 Jul 2013 06:59:59 +0000 Subject: [PATCH] fix sorting favorite lists, fixes #1679 --- pandora/edit/views.py | 3 +++ pandora/itemlist/models.py | 6 ++---- pandora/itemlist/views.py | 3 +++ pandora/text/views.py | 3 +++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/pandora/edit/views.py b/pandora/edit/views.py index 07993476a..f3cff3d91 100644 --- a/pandora/edit/views.py +++ b/pandora/edit/views.py @@ -453,6 +453,9 @@ def sortEdits(request): data = json.loads(request.POST['data']) position = 0 section = data['section'] + section = { + 'favorite': 'public' + }.get(section,section) #ids = list(set(data['ids'])) ids = data['ids'] if section == 'featured' and not request.user.get_profile().capability('canEditFeaturedEdits'): diff --git a/pandora/itemlist/models.py b/pandora/itemlist/models.py index dcd8d8afa..fd4c54947 100644 --- a/pandora/itemlist/models.py +++ b/pandora/itemlist/models.py @@ -127,8 +127,7 @@ class List(models.Model): if value == 'private': for user in self.subscribed_users.all(): self.subscribed_users.remove(user) - qs = Position.objects.filter(user=user, - section='section', list=self) + qs = Position.objects.filter(user=user, list=self) if qs.count() > 1: pos = qs[0] pos.section = 'personal' @@ -148,8 +147,7 @@ class List(models.Model): Position.objects.filter(list=self).delete() pos, created = Position.objects.get_or_create(list=self, user=self.user, section='personal') - qs = Position.objects.filter(user=self.user, - section='personal') + qs = Position.objects.filter(user=self.user, section='personal') pos.position = qs.aggregate(Max('position'))['position__max'] + 1 pos.save() for u in self.subscribed_users.all(): diff --git a/pandora/itemlist/views.py b/pandora/itemlist/views.py index 8b180e298..854536773 100644 --- a/pandora/itemlist/views.py +++ b/pandora/itemlist/views.py @@ -369,6 +369,9 @@ def sortLists(request): data = json.loads(request.POST['data']) position = 0 section = data['section'] + section = { + 'favorite': 'public' + }.get(section,section) #ids = list(set(data['ids'])) ids = data['ids'] if section == 'featured' and not request.user.get_profile().capability('canEditFeaturedLists'): diff --git a/pandora/text/views.py b/pandora/text/views.py index e2cd338be..db6731c01 100644 --- a/pandora/text/views.py +++ b/pandora/text/views.py @@ -319,6 +319,9 @@ def sortTexts(request): data = json.loads(request.POST['data']) position = 0 section = data['section'] + section = { + 'favorite': 'public' + }.get(section,section) #ids = list(set(data['ids'])) ids = data['ids'] if section == 'featured' and not request.user.get_profile().capability('canEditFeaturedTexts'):