def post(self): """Use this end point to add a new task""" # data["id"]=len(tasks)+1 # tasks.append(data) # return data ,201 data = api.payload task = TaskModel( title=data["title"], description=data["description"], user_id=get_jwt_identity()) #to get the id of the logged on person task.save_toDB() return task_schema.dump(task), 201
def __init__(self): self.overed_w = None self.task_model = TaskModel() self.task_model.load_tasks() self.list_walker = None self.list_walker_header_row_count = 0 self.listbox = self.rebuild_listbox() self.body = urwid.AttrMap( urwid.Filler(self.listbox, valign="middle", height=('relative', 100), top=2, min_height=10), 'body') footer = urwid.AttrMap(urwid.Text(self.footer_text), 'foot') header = urwid.AttrMap(urwid.Text(self.header_text), 'foot') self.view = urwid.Frame(self.body, header, footer) self.loop = urwid.MainLoop(self.view, self.palette, unhandled_input=self.handle_input) self.loop.run()
def post(self): """ use this ednpoint to add a new task """ data = api.payload task = TaskModel(**data, user_id=get_jwt_identity()) task.create_record() return task_schema.dump(task)