fix sorting favorite lists, fixes #1679
This commit is contained in:
parent
19f345b865
commit
fd496dfee0
4 changed files with 11 additions and 4 deletions
|
@ -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'):
|
||||
|
|
|
@ -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():
|
||||
|
|
|
@ -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'):
|
||||
|
|
|
@ -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'):
|
||||
|
|
Loading…
Reference in a new issue