def fill_tasks(): with open('tasks.json') as f: mock = json.load(f) for i in mock: try: create_user_task(**i) except IntegrityError: continue
def user_page(name): if request.method=='POST': title = request.form['title'] details = request.form['details'] deadline = request.form['deadline'] try: author_id = get_id_by_name(name) except AccountNotFound: abort(404) create_user_task(author_id, title, details, deadline) try: user_tasks = get_user_tasks(name) except AccountNotFound: abort(404) return render_template('user.html', name=name, tasks=user_tasks)
def fill_tasks(): with open('MOCK_DATA_TASKS.json') as f: mock = json.load(f) for i in mock: create_user_task(**i)