fix sorting favorite lists, fixes #1679

This commit is contained in:
j 2013-07-22 06:59:59 +00:00
parent 19f345b865
commit fd496dfee0
4 changed files with 11 additions and 4 deletions

View file

@ -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'):

View file

@ -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():

View file

@ -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'):

View file

@ -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'):