コード例 #1
0
ファイル: test_app.py プロジェクト: JCarr172/learn_flask
    def setUp(self):
        db.create_all()

        sample1 = Tasks(description='This is a test task')

        sample2 = Tasks(description='This is a completed task', complete=True)

        db.session.add(sample1)
        db.session.commit()
        db.session.add(sample2)
        db.session.commit()
コード例 #2
0
def add():
    form = TaskForm()
    if form.validate_on_submit():
        new_task = Tasks(task=form.task.data)
        db.session.add(new_task)
        db.session.commit()
        return redirect(url_for('home'))
    return render_template('add.html', form=form)
コード例 #3
0
def create():
    form = TaskForm()
    if request.method == "POST":
        if form.validate_on_submit():
            new_task = Tasks(description=form.description.data)
            db.session.add(new_task)
            db.session.commit()
            return redirect(url_for("home"))
    return render_template("add.html", title="Create a Task", form=form)
コード例 #4
0
ファイル: routes.py プロジェクト: PhilipL1/todo-list-app
def create():
    form=TaskForm()
    if request.method == "POST": #(check to see if the method a post request.)post request: send  the filled/complete info to the route
        if form.validate_on_submit():#check if the form validates 
            new_task = Tasks(description = form.description.data) #check if new task has been added with the data
            db.session.add(new_task) # add the new task to the route 
            db.session.commit() # commit to the data base itself
            return redirect(url_for("home"))  #redirect back to the home page
    return render_template("add.html", title = "Create a Task", form=form)
コード例 #5
0
ファイル: routes.py プロジェクト: AJBroomfield/todo-list
def create():
    form = TaskForm()
    if request.method == 'POST':
        if form.validate_on_submit():
            new_task = Tasks(desc=form.desc.data)
            db.session.add(new_task)
            db.session.commit()
            return redirect(url_for('home'))
    return render_template("add.html", title='Create a task', form=form)
コード例 #6
0
ファイル: routes.py プロジェクト: jaydenlsf/flask-todo-app
def add():
    form = TaskForm()

    if request.method == "POST":
        if form.validate_on_submit():
            new_task = Tasks(task=form.task.data, status=form.status.data)
            db.session.add(new_task)
            db.session.commit()
            return redirect(url_for("home"))
    return render_template("add.html", title="Add Task", form=form)
コード例 #7
0
    def setUp(self):
        """
        Will be called before every test
        """
        db.create_all()

        task1 = Tasks(description="My First Task")

        db.session.add(task1)
        db.session.commit()
コード例 #8
0
    def setUp(self):
        db.session.commit()
        db.drop_all()
        db.create_all()

        project = Projects(project_name="Testing",
                           owner="Admin",
                           due_date="2020-03-24",
                           start_date="2020-02-17",
                           end_date="2020-03-23",
                           status="Done")

        task = Tasks(task_name="Phase 1",
                     project_id=1,
                     user="******",
                     due_date="2020-03-24",
                     start_date="2020-02-17",
                     end_date="2020-03-23",
                     status="Done")

        db.session.add(project)
        db.session.add(task)

        project = Projects(project_name="Coding",
                           owner="Admin",
                           due_date="2020-03-24",
                           start_date="2020-02-17",
                           end_date="2020-03-23",
                           status="Done")

        task = Tasks(task_name="Phase 2",
                     project_id=2,
                     user="******",
                     due_date="2020-03-24",
                     start_date="2020-02-17",
                     end_date="2020-03-23",
                     status="Done")

        db.session.add(project)
        db.session.add(task)

        db.session.commit()
コード例 #9
0
ファイル: routes.py プロジェクト: agray998/flask-todo-app
def add():
    form = AddTask()
    if request.method == 'POST':
        task_name = form.task_name.data
        task_desc = form.task_desc.data
        task_stat = form.task_stat.data
        newtask = Tasks(name=task_name, desc=task_desc, status=task_stat)
        db.session.add(newtask)
        db.session.commit()
        return redirect(url_for('home'))
    return render_template('add.html', form=form)
コード例 #10
0
ファイル: logic.py プロジェクト: microlb/resize_api
def add_task_to_db(user_id, height, width, name_pic, identifier, pic_base64):

    task = Tasks(name_pic=name_pic[0],
                 height=height[0],
                 width=width[0],
                 pic_base64=pic_base64[0],
                 identifier=identifier,
                 user_id=user_id)
    db.session.add(task)
    db.session.commit()
    return identifier
コード例 #11
0
ファイル: test_app.py プロジェクト: agray998/flask-todo-app
    def setUp(self):
        """
        Will be called before every test
        """
        # Create table
        db.create_all()

        # Create test task
        sample1 = Tasks(name="Testtask",
                        desc='A test task',
                        status='incomplete')

        # save task to database
        db.session.add(sample1)
        db.session.commit()
コード例 #12
0
ファイル: test_db.py プロジェクト: microlb/resize_api
 def test_task(self):
     user_id = 4
     name_pic = 'apple'
     height = 100
     width = 100
     done = False
     identifier = '123456'
     t1 = Tasks(user_id=user_id,
                name_pic=name_pic,
                height=height, width=width,
                done=done, identifier=identifier)
     db.session.add(t1)
     db.session.commit()
     task = Tasks.query.filter(Tasks.user_id == user_id).first()
     self.assertEqual(task.name_pic, name_pic)
     self.assertEqual(task.height, height)
     self.assertEqual(task.width, width)
     self.assertEqual(task.done, done)
     self.assertEqual(task.identifier, identifier)
コード例 #13
0
def addtask(id):
	
	project=Projects.query.filter_by(id=id)
	projectData = project.first()
	form = TaskForm()				
	form.project_id.data=projectData.project_name

	if form.validate_on_submit():
		taskData = Tasks(
			task_name=form.task_name.data,
			user=form.user.data,
			project_id=id,
			due_date=form.due_date.data,
			start_date=form.start_date.data,
			end_date=form.end_date.data,
			status=form.status.data,
		)
		db.session.add(taskData)
		db.session.commit()
		return redirect(url_for('tasks'))
	else:
		print(form.errors)
	return render_template('addtask.html', title='Add Task', form=form)
コード例 #14
0
ファイル: test_unit.py プロジェクト: PhilipL1/todo-list-app
 def setUp(self):  # Set up the database schema(table).
     db.create_all()  # Create table
     test_task = Tasks(
         description="Test the flask app")  # create a new class >>same<<
     db.session.add(test_task)  # save users to database
     db.session.commit()
コード例 #15
0
ファイル: create.py プロジェクト: PhilipL1/todo-list-app
from application.models import db, Tasks

db.drop_all()
db.create_all()

test = Tasks(description="finally works kmt")
db.session.add(test)
db.session.commit()
コード例 #16
0
 def setUp(self):
     db.create_all()
     test_task = Tasks(description="Test the flask app")
     db.session.add(test_task)
     db.session.commit()
コード例 #17
0
ファイル: routes.py プロジェクト: ZakGregory/Flask-Apps
def add(newtask):
    new_task= Tasks(name=newtask)
    db.session.add(new_task)
    db.session.commit()
    return "New task added"
コード例 #18
0
 def setUp(self):
     db.create_all()
     sample1 = Tasks(desc="Eat cheese")     
     db.session.add(sample1)
     db.session.commit()