本文整理汇总了Python中models.Task.recycle方法的典型用法代码示例。如果您正苦于以下问题:Python Task.recycle方法的具体用法?Python Task.recycle怎么用?Python Task.recycle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Task
的用法示例。
在下文中一共展示了Task.recycle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: task_create_commit
# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import recycle [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)