本文整理汇总了Python中models.Task.title方法的典型用法代码示例。如果您正苦于以下问题:Python Task.title方法的具体用法?Python Task.title怎么用?Python Task.title使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Task
的用法示例。
在下文中一共展示了Task.title方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: new_task
# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import title [as 别名]
def new_task(project_id):
pro = Project.objects.get(pk=project_id)
if request.method == "POST":
task = Task()
task.title = request.form['title']
task.project = pro
task.description = request.form['description']
task.save()
return redirect(url_for('tasks_list',project_id=project_id))
return render_template('tasks/new.html',project=pro)
示例2: task_create_commit
# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import title [as 别名]
def task_create_commit():
#print request.json['title'], request.json['name'],request.json['team'], request.json['mobile']
#print request.json['email'], request.json['expect_day'],request.json['type'], type(request.json['type'])
#print request.json['hardware']
task = Task()
task.title = request.json['title']
task.name = request.json['name']
task.team = request.json['team']
task.mobile = request.json['mobile']
task.email = request.json['email']
expect_day = int(request.json['expect_day'])
task.planned_time = datetime.datetime.now() + datetime.timedelta(days=expect_day)
type = int(request.json['type'])
task.type = type
if type == 1:
task.hardware = request.json['hardware']
task.network = request.json['network']
task.storage = request.json['storage']
task.domain = request.json['domain']
expire_month = int(request.json['expire_month'])
task.expired_time = datetime.datetime.now() + datetime.timedelta(days=expire_month*30)
elif type == 2:
task.recycle = request.json['recycle']
task.link = request.json['link']
elif type == 4:
task.handle = request.json['handle']
task.created_user = request.json['name']
task.created_time = datetime.datetime.now()
task.status = 1
db.session.add(task)
db.session.commit()
return jsonify(json=True)
示例3: add_task_ajax
# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import title [as 别名]
def add_task_ajax(request, id):
"""
Simple routine to add a task to a project
TODO: finish this :)
"""
returnDict = {}
if request.method == 'POST':
try:
taskdict = json.loads(request.POST['datadict'])
task = Task()
task.completed = False
task.date_added = datetime.datetime.now()
task.title = taskdict['task_title']
task.description = taskdict['task_description']
task.save()
link = TaskToProject()
link.task = task
link.project = Project.objects.filter(id=id).get()
link.save()
returnDict['id'] = task.id
except Exception, e:
returnDict['error'] = e.message