本文整理汇总了Python中models.Task.description方法的典型用法代码示例。如果您正苦于以下问题:Python Task.description方法的具体用法?Python Task.description怎么用?Python Task.description使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Task
的用法示例。
在下文中一共展示了Task.description方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: p_task_def
# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import description [as 别名]
def p_task_def(p):
'''task_def : TASK id IMPLEMENTS id LPAREN impl_params RPAREN
| TASK id task_contents
'''
if p[3] != 'implements':
task = Task(p[2], script_accumulator[:])
task.requirements = requirement_accumulator[:]
task.roles = role_accumulator[:]
if len(description_accumulator) == 1:
task.description = description_accumulator[0]
del(description_accumulator[:])
del(script_accumulator[:])
del(role_accumulator[:])
del(requirement_accumulator[:])
else:
# get the task template from p[4]
template = TaskTemplate.lookup.get(p[4])
param_names = template.template_parameters
implementation_params_accumulator.reverse()
key = 0
for param in param_names:
template.set_parameter(param, implementation_params_accumulator[key])
key += 1
template.render_task(p[2])
del(implementation_params_accumulator[:])
示例2: new_task
# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import description [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)
示例3: save
# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import description [as 别名]
def save(self):
task = Task()
task.name = self.cleaned_data.get('name')
task.description = self.cleaned_data.get('description')
task.position = self.cleaned_data.get('position')
task.priority = self.cleaned_data.get('priority')
task.completed = self.cleaned_data.get('completed')
task.list = TaskList.objects.get(pk=self.cleaned_data['list_id'])
task.save()
示例4: test_task_should_be_updatable
# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import description [as 别名]
def test_task_should_be_updatable(self):
"""
A Task should be updatable via the ORM
"""
task = Task(description="Workout")
task.save()
self.assertTrue(Task.objects.all().exists())
task.description = "Test"
task.save()
self.assertTrue(Task.objects.filter(description="Test").exists())
示例5: testInsertEntity
# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import description [as 别名]
def testInsertEntity(self):
# Save Entity
t = Task()
t.description = "Hello World"
t.completed = True
t.put()
# Retrieve Entity
database_task = Task.query().fetch(20)
# Test retrieved entity
self.assertEqual(1, len(database_task))
self.assertEqual(True, database_task[0].completed)
self.assertEqual("Hello World", database_task[0].description)
示例6: create_task
# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import description [as 别名]
def create_task(request):
if request.method == "POST":
try:
team = Team.objects.get(key=request.POST["key"])
except Team.DoesNotExist:
return json_response({'status': 0, 'error': "Unknown API key, please check it again."})
except Exception, e:
logging.exception(e)
return json_response({'status': 0, 'error': "Unknown error. Please contact the tech support."})
try:
task = Task()
task.team = team
task.name = request.POST["name"]
task.description = request.POST["description"]
task.save()
return json_response({'status': 1})
except Exception, e:
logging.exception(e)
return json_response({'status': 0, 'error': "Unknown error. Please contact the tech support."})
示例7: add
# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import description [as 别名]
def add():
# Create a new chore form
form = TaskForm()
# Check for a POST and validate the form data
if form.validate_on_submit():
# Create a new chore with the current user as the parent
newTask = Task(parent=ndb.Key("User", users.get_current_user().email()))
# Fill in the details and insert it into the database
newTask.name = form.name.data
newTask.description = form.description.data
newTask.points = form.points.data
newTask.point_type = form.point_type.data
newTask.put()
# Automatically redirect the user to the chore list
return redirect(url_for('.list'))
# If not POSTing then display the default new chore form
return render_template('tasks/new_task.html', form=form)
示例8: add_task_ajax
# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import description [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