fix rename user

This commit is contained in:
j 2018-03-09 16:03:52 +05:30
parent bcd5758b86
commit 1dc5969cbc

View file

@ -30,12 +30,12 @@ def get_location(ip):
return city, country return city, country
def rename_user(user, new): def rename_user(u, new):
import itemlist.models import itemlist.models
import item.models import item.models
import user.models import user.models
old = user.username old = u.username
old_prefix = old + ':' old_prefix = old + ':'
new_prefix = new + ':' new_prefix = new + ':'
@ -69,7 +69,8 @@ def rename_user(user, new):
# update user item find # update user item find
item.models.ItemFind.objects.filter(key='user', value=old).update(value=new) item.models.ItemFind.objects.filter(key='user', value=old).update(value=new)
user.username = new u.username = new
u.save()
def update_groups(model, groups): def update_groups(model, groups):
if isinstance(groups, list): if isinstance(groups, list):