fix name duplicating Foo [2] fixes #535

copy all items not just first 100 duplicating a static list
This commit is contained in:
j 2012-03-10 01:23:44 +01:00
parent 69cbee4bd5
commit 80cb9c8faf
2 changed files with 11 additions and 7 deletions

View file

@ -2,6 +2,7 @@
# vi:si:et:sw=4:sts=4:ts=4
from __future__ import division
import os
import re
import ox
@ -210,7 +211,8 @@ def addList(request):
}
'''
data = json.loads(request.POST['data'])
name = data['name'].strip()
data['name'] = re.sub(' \[\d+\]$', '', data['name']).strip()
name = data['name']
if not name:
name = "Untitled"
num = 1
@ -349,13 +351,14 @@ def editList(request):
list.status = value
elif key == 'name':
name = data['name'].strip()
data['name'] = re.sub(' \[\d+\]$', '', data['name']).strip()
name = data['name']
if not name:
name = "Untitled"
num = 1
while models.List.objects.filter(name=name, user=list.user).exclude(id=list.id).count()>0:
num += 1
name = data['name'] + ' (%d)' % num
name = data['name'] + ' [%d]' % num
list.name = name
elif key == 'description':
list.description = ox.parse_html(data['description'])

View file

@ -46,17 +46,18 @@ pandora.addList = function() {
pandora.api.find({
query: query,
keys: ['id'],
sort: [{key: 'id', operator: ''}]
sort: [{key: 'id', operator: ''}],
range: [0, result.data.items]
}, function(result) {
var items = result.data.items.map(function(item) {
return item.id;
});
addList(items);
})
});
} else {
addList();
}
})
});
} else {
addList();
}
@ -69,7 +70,7 @@ pandora.addList = function() {
items: items
}, function() {
getPosterFrames(newList);
})
});
} else {
getPosterFrames(newList);
}