Exemplo n.º 1
0
 def POST(self, cid, pid):
     form = web.input()
     model.update_item(alltable['class'], int(cid), form)
     if pid == '':
         raise web.seeother('/index_class/')
     else:
         raise web.seeother('/index_class_project/' + pid)
Exemplo n.º 2
0
 def POST(self, pid):
     if logged():
         table = alltable['project']
         form = web.input()
         model.update_item(table, int(pid), form)
         raise web.seeother('/index_project')
     else:
         raise web.seeother('/')
Exemplo n.º 3
0
 def POST(self, tablename, tid):
     if logged():
         table = alltable[tablename]
         form = web.input()
         model.update_item(table, int(tid), form)
         raise web.seeother('/index_item/' + table[0])
     else:
         raise web.seeother('/')
Exemplo n.º 4
0
 def PUT(self):
     """ Recieved a PUT request, so updating an existing item """
     data = json.loads(web.data())
     model.update_item(data)
     data = [{
         "name": data['name'],
         "description": data['description'],
         "quantity": data['quantity'],
         "purchase_price": data['purchase_price'],
         "sale_price": data['sale_price'],
         "location": data['location'],
         "id": data['id']
     }]
     web.header("Content-Type","application/json")
     web.header("Cache-Control","no-cache")
     return json.dumps(data)
Exemplo n.º 5
0
 def PUT(self):
     """ Recieved a PUT request, so updating an existing item """
     data = json.loads(web.data())
     model.update_item(data)
     data = [{
         "name": data['name'],
         "description": data['description'],
         "quantity": data['quantity'],
         "purchase_price": data['purchase_price'],
         "sale_price": data['sale_price'],
         "location": data['location'],
         "id": data['id']
     }]
     web.header("Content-Type", "application/json")
     web.header("Cache-Control", "no-cache")
     return json.dumps(data)
Exemplo n.º 6
0
def dashboard():
    if request.method == 'GET':
        lists = model.show_all_lists()
        return render_template('dashboard.html', lists=lists)
    else:
        lists = model.show_all_lists()
        if 'show_items' in request.form:
            todo_list = request.form['lists']
            list_items = model.show_all_list_items(todo_list)
            return render_template('dashboard.html',
                                   lists=lists,
                                   list_items=list_items)

        if 'update_item' in request.form:
            lists = model.show_all_lists()
            todo_list = request.form['lists']
            list_items = request.form['item']
            model.update_item(todo_list, list_items)
            return render_template('dashboard.html',
                                   lists=lists,
                                   list_items=list_items)
Exemplo n.º 7
0
 def POST(self,cid,pid):
     table=alltable['class']
     form=web.input()
     model.update_item(table,int(cid),form)
     raise web.seeother('/index_class/'+pid)
Exemplo n.º 8
0
 def POST(self,tid):
     table=alltable['project']
     form=web.input()
     model.update_item(table,int(tid),form)
     raise web.seeother('/index_project')
Exemplo n.º 9
0
def update_item():
    item = request.form['item']
    if item:
        model.update_item(item)