当前位置: 首页>>代码示例>>Python>>正文


Python Task.name方法代码示例

本文整理汇总了Python中models.Task.name方法的典型用法代码示例。如果您正苦于以下问题:Python Task.name方法的具体用法?Python Task.name怎么用?Python Task.name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Task的用法示例。


在下文中一共展示了Task.name方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _add_task

# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import name [as 别名]
def _add_task(data, user, id=0):
    logger.debug("Task name = %s", data[NAME])

    if id:
        # get existing task
        task = Task.objects.get(pk=id)

        if not task.editable:
            raise IgniteException(ERR_TASK_NOT_EDITABLE)
    else:
        # create new task
        task = Task()

    task.name = data[NAME]
    task.handler = data[HANDLER]
    task.function = data[FUNCTION]
    task.desc = data[DESCRIPTION]
    task.location_access_protocol = data[LOC_ACCESS_PROTO]
    task.location_server_ip = data[LOC_SERVER_IP]
    task.location_server_user = data[LOC_SERVER_USER]
    password = encrypt_data(data[LOC_SERVER_PASSWORD])
    task.location_server_password = password
    task.is_encrypted = True
    task.parameters = data[PARAMETERS]
    task.updated_by = user
    task.save()
    return task
开发者ID:datacenter,项目名称:ignite,代码行数:29,代码来源:task.py

示例2: save_task

# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import name [as 别名]
def save_task(request):
    """ Save a new task or update an old one.
    """
    tids = request.POST.get('t_id','')
    if '-' in tids:
        item, task = tids.split('-')
    else:
        item = tids
        task = None
    logger.debug('save_task: item=%s, task=%s'%(item,task))
    tname = request.POST.get('tname','')
    ttech = request.POST.get('ttech','')
#    est = request.POST.get('testimate','')
    notes = request.POST.get('tnotes','')
    if task:
        logger.debug('save_task: update SprintTask, id=%s'%task)
        t = Task.objects.get(pk=int(task))
    else:
        logger.debug('save_task: new SprintTask,item_id=%s'%item)
        try:
            itm = Backlog.objects.get(pk=item)
        except:
            logger.error('save_task: Backlog(%s) not found in db'%item)
            return HttpResponse('{"error":"%s"}'%_('Backlog item not found, please check.'))
        t = Task(item=itm)
    t.name = tname
    t.technology = ttech
    t.notes = notes
    t.number = int(time.time()) % 1000000000
    try:
        t.save()
        return HttpResponse('{"status":"OK","item":"%s","task":"%s"}' % (item, t.pk))
    except Exception,e:
        logger.error('save_task error: %s'%e)
        return HttpResponse('{"error":"%s"}'%_('Error saving task, retry later.'))
开发者ID:tedwen,项目名称:tea-scrum,代码行数:37,代码来源:views.py

示例3: seed_task

# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import name [as 别名]
def seed_task(request):
    task = Task()
    task.name = 'TGA'
    task.message = 'Testdriving Google Appengine'
    task.deadline = datetime.datetime.now()
    task.cache_and_put()

    return HttpResponse("Task seeded!")
开发者ID:ynov,项目名称:gae-django-session,代码行数:10,代码来源:views.py

示例4: save

# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import name [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()
开发者ID:imanoleizaguirre,项目名称:mytasks,代码行数:12,代码来源:forms.py

示例5: assign_alias

# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import name [as 别名]
def assign_alias(request,id):
	alias = get_object_or_404( TaskAlias, pk = id )

	if 'POST' == request.method:
		form = AliasForm( request.POST, instance = alias )
		form.fields['task'].queryset = Task.objects.all().order_by('name')

		# Make a task from this alias
		if 'makeonefromthis' in form.data:
			# Check this already hasnt been done
			existing = Task.objects.filter(name=alias.string)
			if existing:
				request.notifications.error('Looks like you have already done this')
				return HttpResponseRedirect(reverse('assign_alias', args=[id]))

			else:
				# No existing task with this name, create one based on this alias
				task = Task()
				task.name = alias.string
				task.save()

				alias.task = task
				alias.save()
				request.notifications.success('Proper task created from alias')
				return HttpResponseRedirect(reverse('home'))

		# Save alias against chosen task
		elif form.is_valid():
			obj = form.save()
			request.notifications.success('Thanks, now %s is known as %s' % ( alias.string, obj.task ) )
			return HttpResponseRedirect(reverse('home'))
		else:
			pass

	else:
		form = AliasForm(instance = alias)
		form.fields['task'].queryset = Task.objects.all().order_by('name')


	return render(request,'assign_alias.html', { 
		'title' : '"%s"' % alias.string, 
		'form' : form,
		'success_url' : reverse('home') 
	})
开发者ID:errkk,项目名称:timesheets,代码行数:46,代码来源:views.py

示例6: create_task

# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import name [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."})
开发者ID:UFAL-DSG,项目名称:teyb,代码行数:23,代码来源:views.py

示例7: add

# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import name [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)
开发者ID:jmgilman,项目名称:Omega-Python,代码行数:23,代码来源:controllers.py

示例8: task_create_commit

# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import name [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)
开发者ID:liujitao,项目名称:teamworkflow,代码行数:38,代码来源:views.py


注:本文中的models.Task.name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。