Example #1
0
 def get(self, n):
     try:
         n = int(n)
     except ValueError:
         n = RETRIEVE_DEFAULT_NR
     if n <= 0:
         n = RETRIEVE_DEFAULT_NR
     todoList = TodoModel.retrieve_last_N_items(n)
     return jsonify({
         'success': True,
         'todoList': [{'text': item} for item in todoList]
         })
Example #2
0
 def get(self, n):
     try:
         n = int(n)
     except ValueError:
         n = RETRIEVE_DEFAULT_NR
     if n <= 0:
         n = RETRIEVE_DEFAULT_NR
     todoList = TodoModel.retrieve_todos(n)
     return jsonify({
         'success': True,
         'todoList': [{ 'id': item[0], 'text':item[1], 'value':item[2] } for item in todoList]
     })
Example #3
0
 def get(self, n):
     try:
         n = int(n)
     except ValueError:
         n = RETRIEVE_DEFAULT_NR
     if n <= 0:
         n = RETRIEVE_DEFAULT_NR
     todoList = TodoModel.retrieve_last_N_items(n)
     return jsonify({
         'success': True,
         'todoList': [{
             'text': item
         } for item in todoList]
     })
Example #4
0
 def get(self, n):
     try:
         n = int(n)
     except ValueError:
         n = RETRIEVE_DEFAULT_NR
     if n <= 0:
         n = RETRIEVE_DEFAULT_NR
     todoList = TodoModel.retrieve_todos(n)
     return jsonify({
         'success':
         True,
         'todoList': [{
             'id': item[0],
             'text': item[1],
             'value': item[2]
         } for item in todoList]
     })
Example #5
0
 def post(self):
     args = json.loads(request.data)
     TodoModel.add_item(args['item'])
     return jsonify({'success': True})
Example #6
0
 def post(self):
     args = json.loads(request.data)
     TodoModel.add_item(args['item'])
     return jsonify({'success': True})
Example #7
0
 def post(self):
     args = json.loads(request.data)
     print("Changed done value to:", args)
     TodoModel.add_value(args['id'], args['value'])
     return jsonify({'success': True})
Example #8
0
 def post(self):
     args = json.loads(request.data)
     print("Changed done value to:", args)
     TodoModel.add_value(args['id'], args['value'])
     return jsonify({'success' : True})