fix edit call (changelog)

This commit is contained in:
j 2014-12-18 17:39:48 +00:00
parent 8fd99ac1be
commit 9c28041171
2 changed files with 2 additions and 1 deletions

View file

@ -228,6 +228,7 @@ class Item(models.Model):
return False return False
def edit(self, data): def edit(self, data):
data = data.copy()
#FIXME: how to map the keys to the right place to write them to? #FIXME: how to map the keys to the right place to write them to?
if 'id' in data: if 'id' in data:
#FIXME: check if id is valid and exists and move/merge items accordingly #FIXME: check if id is valid and exists and move/merge items accordingly

View file

@ -545,13 +545,13 @@ def edit(request, data):
user_groups = set([g.name for g in request.user.groups.all()]) user_groups = set([g.name for g in request.user.groups.all()])
other_groups = list(groups - user_groups) other_groups = list(groups - user_groups)
data['groups'] = [g for g in data['groups'] if g in user_groups] + other_groups data['groups'] = [g for g in data['groups'] if g in user_groups] + other_groups
add_changelog(request, data)
r = item.edit(data) r = item.edit(data)
if r: if r:
r.wait() r.wait()
if update_clips: if update_clips:
tasks.update_clips.delay(item.public_id) tasks.update_clips.delay(item.public_id)
response['data'] = item.get_json() response['data'] = item.get_json()
add_changelog(request, data)
else: else:
response = json_response(status=403, text='permission denied') response = json_response(status=403, text='permission denied')
return render_to_json_response(response) return render_to_json_response(response)