示例#1
0
文件: wasted.py 项目: treibholz/waste
    def POST(self):
        NewTaskForm = Index.NewTaskForm()

        if NewTaskForm.validates():
            model.new_task(NewTaskForm.d.title, NewTaskForm.d.tags)

        raise web.seeother(path + '/')
示例#2
0
def add_task():
    
    title = request.form["new_task_title"]  
    
    task_id = model.query("GET TASK_ID")
    model.update_id(task_id)
    task_id_updated = int(task_id) + 1

    model.new_task(title, task_id_updated)

    return redirect("/")
示例#3
0
    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('/')
示例#4
0
def save_task():
	task_title = request.form['add_title']
#	db = model.connect_db() - took out when added global db call
	# Assume that all tasks are attached to user 1.
	# Need to automate
	task_id = model.new_task(g.db, task_title, 1)
	return redirect("/tasks")
示例#5
0
def save_task():
	task_title = request.form['task_title']
	user_id = request.form['user_id']
	db = model.connect_db()
# assume all tasks are attached to user 1 :(
	task_id = model.new_task(db, task_title, user_id)
	return redirect("/tasks")
示例#6
0
def save_task():
	title = request.form['title']
	db = model.connect_db()
	#Assume that all tasks are attached to user Christian Fernandez
	#task ID below
	task_id = model.new_task(db, title, 'Christian', 'Fernandez')
	return redirect("/tasks")
示例#7
0
def add_task_create():
    model.connect_to_db()
    title = request.args.get("title")
    user_id = request.args.get("user_id")
    created_at = request.args.get("datestamp")
    row = model.new_task(title, created_at, user_id)
    html = render_template("added_task.html")
    return html
 def POST(self):
     mydoc = web.input(file={})['file']
     #записали файл
     f = open('/tmp/converterdir/' + mydoc.filename, 'w')
     f.write(mydoc.value)
     #зарегисрировали задачу
     n = model.new_task(mydoc.filename, 0,
                        '/tmp/converterdir/' + mydoc.filename)
     #вернули её номер
     return n
示例#9
0
def save_task():
    # print request.form
    task_title = request.form['task_title']
    category = request.form["category"]
    priority = request.form["priority"]
    due_date = request.form["due_date"]

    #due_date = datetime.datetime.now()
    db = model.connect_db()
    created_at = datetime.datetime.now()
    task_id = model.new_task(db, task_title, 1, created_at, 0, category, None,
                             priority, due_date)
    # return "Success!"
    return redirect("/tasks")
def save_task():
	# print request.form
	task_title = request.form['task_title']
	category = request.form["category"]
	priority = request.form["priority"]
	due_date = request.form["due_date"]
	
	#due_date = datetime.datetime.now()
	db = model.connect_db()
	created_at = datetime.datetime.now()
	task_id = model.new_task(db, task_title, 1, 
							 created_at, 0, 
							 category, None, priority, due_date)
	# return "Success!"
	return redirect("/tasks")
示例#11
0
def save_task():
	task_title = urllib.quote(request.form['task_title']) # request object representing state of user browser, contents from form are put into dictionary on the 'request' object
	# encoding all input

	# check for title in task form: if none, flash error & redirect
	if not task_title:
		flash("You must enter a title for your task")
		return redirect(url_for('new_tasks'))
	
	task_description = urllib.quote(request.form['task_description'])
	
	task_due_date = urllib.quote(request.form['task_due_date'])
	
	# using regex to check that date is in format of MM-DD-YY [1-12]-[1-31]-[13-99]
	date_comparison = re.match(r'^((0[0-9])|(1[0-2]))-((0[1-9])|(1|2)[0-9]|(3[0|1]))-((1[3-9])|([2-9][0-9]))', task_due_date)
	
	if date_comparison:
		# set new task specific to user_id
		task_id = model.new_task(g.db, task_title, task_description, task_due_date, session['user_id'])
		return redirect(url_for('list_tasks'))

	else:
		flash("Your date is not in the right format!") #flashing system basically makes it possible to record a message at the end of a request and access it next request and only next request
		return redirect(url_for('new_tasks'))
示例#12
0
文件: seed.py 项目: moonlimb/tipsy
"Eat at Thai 360",
"Eat at Tartine Bakery",
"Eat at Dante's Weird Fish",
"Eat at Pancho Villa",
"Eat at Rhea's Sandwiches",
"Eat at Limon Rotisserie",
"Eat at Foreign Cinema",
"Eat at The House",
"Eat at Pesce",
"Eat somewhere in Chinatown (mysterious)",
"Eat at the Ferry Building",
"Go to farmer's market",
"Watch reality tv",
"Watch a movie",
"Get tipsy",
"Get drunk",
"Get wasted",
"Blackout",
"Eat brunch the following day to cure hangover",
"Buy wine"]

index = 19

for email, pwd, name in list_of_users:
    user_id = model.new_user(db, email, pwd, name)

    if index >= 1:
        task1 = model.new_task(db, list_of_tasks[index], user_id)
        task2 = model.new_task(db, list_of_tasks[index-1], user_id)
        index -= 2
示例#13
0
文件: seed.py 项目: adelaide01/tipsy
"""
seed.py
"""
import model

db = model.connect_db()
ben_id = model.new_user(db, "*****@*****.**", "benpass123", "Ben")
task1 = model.new_task(db, "buy flowers for my wife", ben_id)
task2 = model.new_task(db, "dress rehearsal", ben_id)
示例#14
0
def save_task():
	task_title = request.form['task_title']
	db = model.connect_to_db()
	#Assume that all tasks are attached to user 1.
	task_id = model.new_task(db, task_title, 1)
	return redirect("/tasks")
示例#15
0
文件: tipsy.py 项目: Eleonore9/Tipsy
def save_task():
	task_title = request.form['task_title']
	db = model.connect_db()
	task_id = model.new_task(db, task_title, 1)
	return redirect("/Tasks")
示例#16
0
#erase the database and start fresh, using the same data

import model

db = model.connect_db()
user_id = model.new_user(db, "*****@*****.**", "securepassword", "Christian")
task = model.new_task(db, "Complete this task list", user_id)

user_id = model.new_user(db, "*****@*****.**", "securepassword", "Christian")
task = model.new_task(db, "Complete this task list", user_id)
user_id = model.new_user(db, "*****@*****.**", "securepassword", "Christian")
task = model.new_task(db, "Complete this task list", user_id)
user_id = model.new_user(db, "*****@*****.**", "securepassword", "Christian")
task = model.new_task(db, "Complete this task list", user_id)
user_id = model.new_user(db, "*****@*****.**", "securepassword", "Christian")
task = model.new_task(db, "Complete this task list", user_id)
user_id = model.new_user(db, "*****@*****.**", "securepassword", "Christian")
task = model.new_task(db, "Complete this task list", user_id)
user_id = model.new_user(db, "*****@*****.**", "securepassword", "Christian")
task = model.new_task(db, "Complete this task list", user_id)
user_id = model.new_user(db, "*****@*****.**", "securepassword", "Christian")
task = model.new_task(db, "Complete this task list", user_id)
示例#17
0
def save_task():
    db = model.connect_db()
    title = request.form['title']
    model.new_task(db, title)
    return redirect("/tasks")
示例#18
0
def save_task():
    title = request.form['new_item']
    model.new_task(g.db, title, 1)
    return redirect(url_for("list_tasks"))
示例#19
0
文件: tipsy.py 项目: emi1337/webstuff
def edit_task():
	task_title = request.form["task_title"]
	db = model.connect_db()
	#Assumer that all tasks are attached to user 1.
	task_id = model.new_task(db, task_title, 1)
	return redirect("/tasks")
示例#20
0
"""
seed.py
"""
import model

db = model.connect_db()
# user_id = model.new_user(db, "*****@*****.**", "securepassword", "Christian")
# task = model.new_task(db, "Complete this task list", user_id)
user_id = model.new_user(db, "*****@*****.**", "password", "Gulnara")
task = model.new_task(db, "we did it!", user_id)
task = model.new_task(db, "almost done!!", user_id)
示例#21
0
文件: tipsy.py 项目: adelaide01/tipsy
def save_task():
	title = request.form['title']
	db = model.connect_db()
	task_id = model.new_task(db, title, 2)
	#Assume that all tasks are attached to user 2.
	return redirect("/tasks")
示例#22
0
文件: seed.py 项目: ksenish/tipsy
"""
seed.py
"""
import model

db = model.connect_db()
user_id = model.new_user(db, "*****@*****.**", "securepassword", "Christian")
task = model.new_task(db, "Complete this task list", user_id)
task2 = model.new_task(db, "Steal Christian's cane", user_id)
task3 = model.new_task(db, "Replace Liz with Ksenia", user_id)

示例#23
0
def save_task():
    user_id = session.get("user_id", None)
    title = request.form['title']
    model.new_task(g.db, title, user_id["id"])
    return redirect("/tasks")
示例#24
0
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
示例#25
0
文件: tipsy.py 项目: ksenish/tipsy-1
def save_task():
    title = request.form['title']
    model.new_task(g.db, title)
    return redirect("/tasks")
示例#26
0
"""
seed.py
"""
import model

db = model.connect_db()
user_id = model.new_user(db, "*****@*****.**", "securepassword", "Christian")
task = model.new_task(db, "Complete this task list", user_id)
user_id = model.new_user(db, "*****@*****.**", "securepassword", "Megan")
task = model.new_task(db, "Put together camping supplies", user_id)
user_id = model.new_user(db, "*****@*****.**", "thisisapassword", "Brian")
task = model.new_task(db, "Subscribe to city car service", user_id)
task = model.new_task(db, "Reserve a vehicle", user_id)
task = model.new_task(db, "Reserve a camping space", user_id)
task = model.new_task(db, "Confirm number of guest", user_id)
task = model.new_task(db, "Print directions to Big Sur", user_id)
示例#27
0
"""
seed.py
"""
import model

db = model.connect_db()
user_id = model.new_user(db, "*****@*****.**", "securepassword", "Christian")
task = model.new_task(db, "Brush hair", user_id)
task = model.new_task(db, "Complete this task list", user_id)
task = model.new_task(db, "Sleep", user_id)

user_id = model.new_user(db, "*****@*****.**", "securepassword", "Laura")
task = model.new_task(db, "Tweet", user_id)
task = model.new_task(db, "Blog", user_id)
task = model.new_task(db, "Caltrain to San Jose", user_id)

user_id = model.new_user(db, "*****@*****.**", "securepassword", "Elle")
task = model.new_task(db, "Tweet", user_id)
task = model.new_task(db, "Blog", user_id)
task = model.new_task(db, "Caltrain to San Jose", user_id)

user_id = model.new_user(db, "*****@*****.**", "securepassword", "Meggie")
task = model.new_task(db, "Bike to Berkeley", user_id)
task = model.new_task(db, "Write swimming exercises", user_id)
task = model.new_task(db, "Sew stockings", user_id)
task = model.new_task(db, "Blog", user_id)
示例#28
0
文件: seed.py 项目: aerialdomo/tipsy
"""
seed.py
"""
import model

db = model.connect_db()
user_id = model.new_user(db, "*****@*****.**", "party", "Pinky Pie")
task = model.new_task(db, "throw a party", user_id)
示例#29
0
"""
seed.py
"""
import model

db = model.connect_db()

user_id = model.new_user(db, "*****@*****.**", "securepassword", "Christian")
task = model.new_task(db, "Complete my task list", user_id)

user_id = model.new_user(db, "*****@*****.**", "cynpass", "Cynthia")
task = model.new_task(db, "Walk my dog", user_id)

user_id = model.new_user(db, "*****@*****.**", "Lizpass", "Liz")
task = model.new_task(db, "Teach classes", user_id)

user_id = model.new_user(db, "*****@*****.**", "securepassword", "Christian")
task = model.new_task(db, "Become a wizard", user_id)

user_id = model.new_user(db, "*****@*****.**", "internpass", "Interns")
task = model.new_task(db, "Keep being awesome", user_id)
示例#30
0
文件: seed.py 项目: emi1337/webstuff
import model

db = model.connect_db()
user_id = model.new_user(db, "*****@*****.**", "password", "Christian")
task = model.new_task(db, "Complete this task list", user_id)
user_id = model.new_user(db, "*****@*****.**", "password", "Elmo")
task = model.new_task(db, "Hugs", user_id)
user_id = model.new_user(db, "*****@*****.**", "password", "CMonster")
task = model.new_task(db, "Eat Cookies.", user_id)
user_id = model.new_user(db, "*****@*****.**", "password", "Kermit")
task = model.new_task(db, "Ribbit", user_id)
user_id = model.new_user(db, "*****@*****.**", "password", "The Count")
task = model.new_task(db, "1, 2, 3", user_id)
task = model.new_task(db, "4, 5, 6", user_id)
import model
import datetime

db = model.connect_db()
user_id = model.new_user(db, "*****@*****.**", "securepassword", "Christian")
task = model.new_task(db, "A task for Christian", user_id, datetime.datetime.now(),
					  None, "category3", None, 4, "Tuesday")
task = model.new_task(db, "The best task OH MY FREAKING GOD", user_id, datetime.datetime.now(),
					  None, "category3", None, 5, "Next year")
user_id = model.new_user(db, "*****@*****.**", "awesomepassword", "Gulnara")
task = model.new_task(db, "let's drink", user_id, datetime.datetime.now(),
					  None, "category3", None, 1, "in an hour")
task = model.new_task(db, "go to sleep", user_id, datetime.datetime.now(),
					  None, "category4", None, 2, "in 2 hours")
user_id = model.new_user(db, "*****@*****.**", "yeahyeahyeah", "Lindsay")
task = model.new_task(db, "go hiking", user_id, datetime.datetime.now(),
					  None, "category78", None, 3, "sunday")
task = model.new_task(db, "read a few books", user_id, datetime.datetime.now(),
					  None, "category54", None, 4, "this weekend")
示例#32
0
def save_task():
    title = request.form["title"]
    user_id = session["user_id"]
    model.new_task(g.db, title, user_id)
    return redirect("/tasks")