Skip to content
Snippets Groups Projects
Commit 0dc29c2d authored by Julian Rother's avatar Julian Rother
Browse files

Simplified usage of edit api

parent 67786ef6
No related branches found
No related tags found
No related merge requests found
...@@ -245,8 +245,12 @@ def edit(): ...@@ -245,8 +245,12 @@ def edit():
'comment', 'internal']) 'comment', 'internal'])
} }
query('BEGIN TRANSACTION') query('BEGIN TRANSACTION')
for key, val in request.get_json(): if request.is_json():
table, column, id = key.split('.', 2) changes = request.get_json().items()
else:
changes = request.args.items()
for key, val in changes:
table, id, column = key.split('.', 2)
assert table in tabs assert table in tabs
assert column in tabs[table][2] assert column in tabs[table][2]
query('UPDATE %s SET %s = ? WHERE %s = ?'%(tabs[table][0], column, query('UPDATE %s SET %s = ? WHERE %s = ?'%(tabs[table][0], column,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment