def GET(self): tasks = model.get_tasks() tasks = [dict(task=row['task'], start=row['startdate'], end=row['enddate'], priority=row['priority'], \ diff=get_days_left(row['enddate']))\ for row in tasks] form = self.form() return render.index(tasks, form)
def list_tasks(): db = model.connect_db() tasks_from_db = model.get_tasks(db, None) completed_items = request.form.getlist("completed_t_f", type=int) if completed_items: for task in completed_items: model.complete_task(db, task) return render_template("tasks.html", tasks_field = tasks_from_db)
def list_tasks(): db = model.connect_db() tasks_from_db = model.get_tasks(db, None) user_id_list = [] for dictionary in tasks_from_db: user_id_list.append(dictionary["user_id"]) for user_id in user_id_list: users_from_db = model.get_user(db, user_id) return render_template("list_tasks.html", tasks=tasks_from_db,users=users_from_db)
def list_tasks(): #TODO: Make another thing that returns everything nessecary for this view, by using a join instead of having python do multiple queries. tasks_from_db = model.get_tasks(g.db, None) # this returns a list of dictionaries for dicts in tasks_from_db: for key in ("title", "description"): dicts[key] = urllib.unquote(dicts[key]) return render_template("list_tasks.html", tasks=tasks_from_db)
def GET(self): resp = model.get_tasks() todos = resp.json() form = self.form() if resp.status_code != 200: # This means something went wrong. raise ApiError('GET /todos/ {}'.format(resp.status_code)) return render.index(todos[u'todos'], form)
def list_tasks(): db = model.connect_db() tasks_from_db = model.get_tasks(db, None) completed_items = request.form.getlist("completed_t_f", type=int) if completed_items: for task in completed_items: model.complete_task(db, task) return render_template("tasks.html", tasks_field=tasks_from_db)
def POST(self): """add new task""" form = self.form() if not form.validates(): tasks = model.get_tasks() tasks = [dict(task=row['task'], start=row['startdate'], end=row['enddate'], priority=row['priority'], \ diff=get_days_left(row['enddate']))\ for row in tasks] return render.index(tasks, form) model.new_task(form.d.task, form.d.startdate, form.d.enddate, form.d.priority) raise web.seeother('/')
def _list(): if request.method == 'GET': data = model.get_tasks() return render_template("todo_list.html", data=data) else: task = request.form['task'] due_date = request.form['due_date'] add_task = model.add_task(task, due_date) message = "new task added" return render_template("todo_list.html", message=message) if username in session: g.user = session['username'] return render_template("todo_list.html", message="yes") return render_template("todo_list.html", message=add_task)
def main(): if len(sys.argv) != 3: print("Error: Los parámetros indicados son incorrectos") return 1 if sys.argv[1] != "--timesheet-option": print( "Error: Por favor indicar el parámetro 'timesheet-option' mediante el flag --timesheet-option" ) return 1 timesheet_option = sys.argv[2] tasks = get_tasks() if timesheet_option == "new": login(credentials=credentials) new_timesheet() fill_timesheet(tasks=tasks) elif timesheet_option == "open": fill_timesheet(tasks=tasks) return 0
def GET(self): NewTaskForm = self.NewTaskForm() DeleteTaskForm = self.DeleteTaskForm() StatusTaskForm = self.StatusTaskForm() DoneTaskForm = self.DoneTaskForm() FilterForm = self.FilterForm() Tasks = model.get_tasks(model.get_taskorder(), model.get_taskfilter()) Tags = model.get_task_tags(model.get_taskfilter()) StatusTaskForm.Status.args = model.get_status_list_tuple() FilterForm.TagFilter.value = model.get_tag_filter() return render.index( NewTaskForm, DeleteTaskForm, StatusTaskForm, DoneTaskForm, FilterForm, Tasks, Tags, path)
""" seed.py """ import model db = model.connect_db() # user_id = model.new_user(db, "*****@*****.**", # "Chocolates", "SusanTan") # task = model.new_task(db, "Use the BART", user_id) # dict1= dict() # dict1= model.get_user(db, 5) # print dict1 a= model.complete_task(db, 1) a= model.complete_task(db, 2) a= model.complete_task(db, 3) a= model.complete_task(db, 4) a= model.complete_task(db, 5) a= model.complete_task(db, 6) a= model.complete_task(db, 7) a=model.get_tasks(db, None) print a # a=model.get_task( db, 7) # print a
def list_tasks(): user_id = session.get("user_id", None) print user_id tasks_from_db = model.get_tasks(g.db, user_id['id']) return render_template("list_tasks.html", tasks=tasks_from_db)
def list_tasks(): db = model.connect_db() return render_template("list_tasks.html", list_all_tasks=model.get_tasks(db, None))
def list_tasks(): db = model.connect_to_db() # connect to the database tasks_from_db = model.get_tasks(db, None) # get a list of all the tasks return render_template("list_tasks.html", tasks= tasks_from_db) #send that list to the list_tasks template as a parameter named "tasks"
def list_tasks(): db = model.connect_db() # use the get_tasks function because you want to pass it NO user_id # and get it to return you the list of dictionaries, which are formatted by html template tasks_from_db = model.get_tasks(db, None) return render_template("list_tasks.html", tasks = tasks_from_db)
def list_tasks(): # db = model.connect_db() - took out when added global db call #following carries the session id through and requires it to lists the tasks user_id = session.get("user_id", None) tasks_from_db = model.get_tasks(g.db, user_id) return render_template("list_tasks.html", tasks=tasks_from_db)
def list_tasks(): if 'usr_id' in session: tasks_from_db = model.get_tasks(g.db, None) return render_template("list_tasks.html", tasks=tasks_from_db) return redirect(url_for("login"))
def list_tasks(): user_id = session.get("user_id", None) tasks_from_db = model.get_tasks(g.db, None) users_from_db= model.call_users(g.db, None) return render_template("list_tasks.html", tasks=tasks_from_db, users= users_from_db)
def tasks(): db = model.connect_db() tasks_from_db = model.get_tasks(db, None) return render_template('tasks.html', user_name="Erica", task_list=tasks_from_db)
ui.print_menu() user_input = logic.user_input("Please Enter your selection: ") if user_input == "1": task = logic.user_input("Please enter your task: ") progress = logic.user_input("Please enter your task progress: ") model.insert_task(task) model.insert_progress(task, progress) #makes program pause logic.user_input("Press any key to continue") elif user_input == "2": course = logic.user_input("Please enter your task to be queried") # query dictionary if model.get_task(course): ui.print_progress(course, model.get_progress(course)) else: ui.print_message("Sorry this task has not been added") logic.user_input("Press any key to continue") elif user_input == "3": many = False for task in model.get_tasks(): ui.print_progress(task, model.get_progress(task), many) many = True if len(model.get_tasks()) == 0: ui.print_message("No task added yet ") #pause program for some time logic.user_input("Press any key to continue ") else: ui.print_message("Good-bye Thanks for Using Progress Tracker") break
def list_tasks(): user_id = session.get("user_id", None) tasks_from_db = model.get_tasks(g.db, user_id["id"]) return render_template("list_tasks.html", tasks=tasks_from_db)
import model db = model.connect_db() user_id = model.new_user(db, '*****@*****.**', 'ilikepie', 'pie', 'pan') print user_id task = model.new_task(db, 'make some pie', user_id) print task model.complete_task(db, task) all_tasks = model.get_tasks(db, user_id) print all_tasks
def list_tasks(): db = model.connect_db() tasks_from_db = model.get_tasks(db, None) return render_template("list_tasks.html", tasks = tasks_from_db)
def list_tasks(): db = model.connect_db() tasks_from_db = model.get_tasks(db, ) #imports the get_tasks function from model.py return render_template("list_tasks.html", tasks=tasks_from_db) #sends retrieved data to a Flask template
def new_task_box(): db= model.connect_db() tasks_from_db= model.get_tasks(db, None) users_from_db= model.call_users(db, None) return render_template("new_task.html", tasks= tasks_from_db, users= users_from_db)
def save_task(): task_title = request.form['task_title'] db = model.connect_db() task_id = model.new_task(db, task_title, 1) tasks_from_db = model.get_tasks(db, None) return render_template("list_tasks.html", tasks=tasks_from_db)