forked from 0x2620/pandora
fix list import during singup
This commit is contained in:
parent
f1f8407f61
commit
e6ce812f1a
1 changed files with 4 additions and 3 deletions
|
@ -154,6 +154,7 @@ def signup(request, data):
|
||||||
}
|
}
|
||||||
see: signin, signout
|
see: signin, signout
|
||||||
'''
|
'''
|
||||||
|
from itemlist.models import List, Position
|
||||||
if 'username' in data and 'password' in data and 'email' in data:
|
if 'username' in data and 'password' in data and 'email' in data:
|
||||||
data['username'] = data['username'].strip()
|
data['username'] = data['username'].strip()
|
||||||
data['email'] = ox.escape_html(data['email'])
|
data['email'] = ox.escape_html(data['email'])
|
||||||
|
@ -186,7 +187,7 @@ def signup(request, data):
|
||||||
user.save()
|
user.save()
|
||||||
#create default user lists:
|
#create default user lists:
|
||||||
for l in settings.CONFIG['personalLists']:
|
for l in settings.CONFIG['personalLists']:
|
||||||
list = models.List(name=l['title'], user=user)
|
list = List(name=l['title'], user=user)
|
||||||
for key in ('query', 'public', 'featured'):
|
for key in ('query', 'public', 'featured'):
|
||||||
if key in l:
|
if key in l:
|
||||||
setattr(list, key, l[key])
|
setattr(list, key, l[key])
|
||||||
|
@ -195,8 +196,8 @@ def signup(request, data):
|
||||||
if c['key'] == 'user':
|
if c['key'] == 'user':
|
||||||
c['value'] = c['value'].format(username=user.username)
|
c['value'] = c['value'].format(username=user.username)
|
||||||
list.save()
|
list.save()
|
||||||
pos = models.Position(list=list, section='personal', user=user)
|
pos = Position(list=list, section='personal', user=user)
|
||||||
qs = models.Position.objects.filter(user=user, section='personal')
|
qs = Position.objects.filter(user=user, section='personal')
|
||||||
pos.position = (qs.aggregate(Max('position'))['position__max'] or 0) + 1
|
pos.position = (qs.aggregate(Max('position'))['position__max'] or 0) + 1
|
||||||
pos.save()
|
pos.save()
|
||||||
if request.session.session_key:
|
if request.session.session_key:
|
||||||
|
|
Loading…
Reference in a new issue