Commit 08c1a192 authored by Nelso Jost's avatar Nelso Jost

FIX: better usage

parent c6a0633b
...@@ -33,8 +33,6 @@ def api_post_rawsensordata(board_id): ...@@ -33,8 +33,6 @@ def api_post_rawsensordata(board_id):
if type(r) is str: if type(r) is str:
r = json.loads(request.json) r = json.loads(request.json)
if not 'user_hash' in r or r['user_hash'] != board.user.password_hash: if not 'user_hash' in r or r['user_hash'] != board.user.password_hash:
return jsonify({'error': 'Missing or invalid JSON "user_hash" ' return jsonify({'error': 'Missing or invalid JSON "user_hash" '
'attribute for board of ID {}.'.format(board_id)}) 'attribute for board of ID {}.'.format(board_id)})
...@@ -75,4 +73,5 @@ def api_post_rawsensordata(board_id): ...@@ -75,4 +73,5 @@ def api_post_rawsensordata(board_id):
db.session.commit() db.session.commit()
return jsonify({'success': 'All data was sucessfully saved on the board.'}) return jsonify({'success': '{} new points were saved on the board.'
...@@ -155,6 +155,12 @@ class Board(db.Model, DBUtils): ...@@ -155,6 +155,12 @@ class Board(db.Model, DBUtils):
sensor.rawdata.delete() sensor.rawdata.delete()
board.sensors.delete() board.sensors.delete()
db.session.delete(board) db.session.delete(board)
def clean_data(self):
for sensor in self.sensors.all():
def send_to_form(self, form): def send_to_form(self, form):
for field in self.__fields__: for field in self.__fields__:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment