fix user/group api
This commit is contained in:
parent
3a56a8138d
commit
f6cebcaec9
1 changed files with 10 additions and 3 deletions
|
@ -385,7 +385,7 @@ def editUser(request, data):
|
||||||
user.save()
|
user.save()
|
||||||
profile.save()
|
profile.save()
|
||||||
add_changelog(request, data, user.username)
|
add_changelog(request, data, user.username)
|
||||||
response['data'] = user.data.get().json()
|
response['data'] = user.data.json()
|
||||||
return render_to_json_response(response)
|
return render_to_json_response(response)
|
||||||
actions.register(editUser, cache=False)
|
actions.register(editUser, cache=False)
|
||||||
|
|
||||||
|
@ -548,7 +548,7 @@ def getUser(request, data):
|
||||||
'''
|
'''
|
||||||
response = json_response()
|
response = json_response()
|
||||||
u = get_user_or_404(data)
|
u = get_user_or_404(data)
|
||||||
response['data'] = u.data.get().json(data.get('keys', []), request.user)
|
response['data'] = u.data.json(data.get('keys', []), request.user)
|
||||||
return render_to_json_response(response)
|
return render_to_json_response(response)
|
||||||
actions.register(getUser)
|
actions.register(getUser)
|
||||||
|
|
||||||
|
@ -931,7 +931,14 @@ def editGroup(request, data):
|
||||||
'''
|
'''
|
||||||
response = json_response(status=200, text='ok')
|
response = json_response(status=200, text='ok')
|
||||||
g = Group.objects.get(id=ox.fromAZ(data['id']))
|
g = Group.objects.get(id=ox.fromAZ(data['id']))
|
||||||
g.name = data['name']
|
name = data['name']
|
||||||
|
n = 1
|
||||||
|
name = data['name']
|
||||||
|
_name = re.sub(' \[\d+\]$', '', name).strip()
|
||||||
|
while Group.objects.filter(name=name).count():
|
||||||
|
n += 1
|
||||||
|
name = u'%s [%d]' % (_name, n)
|
||||||
|
g.name = name
|
||||||
g.save()
|
g.save()
|
||||||
add_changelog(request, data, g.name)
|
add_changelog(request, data, g.name)
|
||||||
response['data'] = group_json(g)
|
response['data'] = group_json(g)
|
||||||
|
|
Loading…
Reference in a new issue