本文整理汇总了Python中tasks.models.Task.priority方法的典型用法代码示例。如果您正苦于以下问题:Python Task.priority方法的具体用法?Python Task.priority怎么用?Python Task.priority使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tasks.models.Task
的用法示例。
在下文中一共展示了Task.priority方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create
# 需要导入模块: from tasks.models import Task [as 别名]
# 或者: from tasks.models.Task import priority [as 别名]
def create(self, request, task_id):
if 'title' not in request.POST:
return rc.BAD_REQUEST
task = Task()
task.title = request.POST.get('title')
task.priority = int(request.POST.get('priority')) if request.POST.get('priority') else 0
task.user = request.user
task.save()
return rc.CREATED
示例2: _create_task
# 需要导入模块: from tasks.models import Task [as 别名]
# 或者: from tasks.models.Task import priority [as 别名]
def _create_task(row, asset):
if row['task'] == '':
return None
try:
task = Task.objects.get(
asset__pk=asset.pk,
name__iexact=row['task'])
except Task.DoesNotExist:
task = Task(name=row['task'], asset=asset)
task.frequency = Frequency.parse(row['frequency'])
task.last_done = _parse_last_done(row['last done'])
task.priority = Priority.parse(row['priority'])
if row['estimate'] != '':
task.estimate = float(row['estimate'])
task.save()
return task
示例3: add_project_task
# 需要导入模块: from tasks.models import Task [as 别名]
# 或者: from tasks.models.Task import priority [as 别名]
def add_project_task(request,slug):
if request.user.is_authenticated() and request.user.is_staff():
project = Project.objects.get(slug = slug)
if request.POST:
form = TaskForm(request.POST)
if form.is_valid():
data = form.cleaned_data
td = data['end_date'] - data['start_date']
if td.total_seconds()>=0:
task = Task()
task.name = data['name']
task.description = data['description']
task.start_date = data['start_date']
task.end_date = data['end_date']
task.user = data['user']
task.priority = data['priority']
task.project = project
task.save()
else:
messages.add_message(request, messages.ERROR,
" end date is less than start date!")
return (redirect(reverse('Task:add_task',kwargs={'slug':project.slug})))
return (redirect(reverse('Home:Projects:manager')))
else:
messages.add_message(request, messages.ERROR,
"invalid form")
return (redirect(reverse('Task:add_task',kwargs={'slug':project.slug})))
else:
form = TaskForm()
send_dict={}
context_instance=RequestContext(request)
send_dict['project'] = project
send_dict['form'] = form
return render_to_response('tasks/add_task.html',send_dict,context_instance)
else:
return redirect(reverse('Login:login'))