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


Python Job.save方法代码示例

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


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

示例1: post

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import save [as 别名]
    def post(self, *args, **kwargs):
        context = self.get_context_data(*args, **kwargs)
        if (not context['offer_form'].is_valid()):
            self.template_name = 'start.html'
        else:
            job = Job()

            job.title = self.request.POST.get('title')
            job.description = self.request.POST.get('description')

            job.location_code = self.request.POST.get('localisation_code')
            job.location_city = self.request.POST.get('localisation_city')
            job.location_province = self.request.POST.get('localisation_province')
            job.location_country = self.request.POST.get('localisation_country')

            job.company = self.request.POST.get('name_company')

            job.contract = self.request.POST.get('contract')
            job.function_code = self.request.POST.get('function')
            job.industry_code = self.request.POST.get('industry')

            job.end_date = datetime.now() + timedelta(30)
            job.state = 0

            job.save()

            context['job'] = job

            context['options'] = {
                'schools': True,
                'pe': True,
            }

        return self.render_to_response(context)
开发者ID:asadones,项目名称:EasyHackers,代码行数:36,代码来源:views.py

示例2: bmanager_post_job

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import save [as 别名]
def bmanager_post_job(request):
    jsonData =json.loads(request.body)

    job = Job()
    job.basename        = jsonData['job']['basename']
    job.format          = jsonData['job']['format']
    job.input_filename  = jsonData['job']['input_filename']
    job.input_path      = jsonData['job']['input_path']


    try:
        job.profile = Profile.objects.get(name=jsonData['job']['profile'])
    except ObjectDoesNotExist:
        status = http_NOT_FOUND
        return HttpResponse(json.dumps({'message': 'Profile not found'}), status=status, content_type='application/json')

    dest_list = []
    destinations = jsonData['job']['destinations']

    for destination in destinations:
        try:
            dest_list.append(Destination.objects.get(name=destination))
            #job.destinations.add(Destination.objects.get(name=destination))
        except ObjectDoesNotExist:
            status = http_NOT_FOUND
            return HttpResponse(json.dumps({'message': 'Destination not found'}), status=status,content_type='application/json')

    job.save()
    job.destinations = dest_list
    #job.save()

    response = {"job": {"id": job.id, "basename": job.basename}}
    status = http_POST_OK
    return HttpResponse(json.dumps(response), status=status, content_type='application/json')
开发者ID:npajoni,项目名称:tubuceta,代码行数:36,代码来源:views.py

示例3: post

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import save [as 别名]
    def post(self, request, *args, **kwargs):
        form = JobForm(request.POST, request.FILES)
        if form.is_valid():
            now = datetime.datetime.now()
            name = request.POST['name']
            description = request.POST['description']
            interval = request.POST['interval']
            interval_options = request.POST['interval_options']
            arguments = request.POST['arguments']
            active = False
            try:
                request.POST['active']
                active = True
            except:
                pass

            file = request.FILES['file']
            file_content = file.read()
            file_name = str(now.year) + str(now.month) + str(now.day) + str(now.hour) + str(now.minute) + str(now.second) + str(now.microsecond) + name.replace(' ', '-') + '.py'
            f = open(BASE_DIR + '/job_files/' + file_name, 'w')
            f.write(file_content)
            f.close()

            #Save job
            new_job = Job(name=name, description=description, interval=interval, interval_options=interval_options, arguments=arguments, active=active, file_name=file_name)
            new_job.save()

            res = 'Job created'

        return render_to_response(self.template_name, locals(), context_instance=RequestContext(request))
开发者ID:trencube,项目名称:SchPark,代码行数:32,代码来源:views.py

示例4: elemento_PostJob

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import save [as 别名]
def elemento_PostJob(request):

    jsonData = json.loads(request.body)

    job = Job()
    job.input_filename     = jsonData['job']['input_filename']
    job.input_path         = jsonData['job']['input_path']
    job.name               = jsonData['job']['name']
    job.basename           = jsonData['job']['basename']
    if 'hls_preset_id' in jsonData['job']:
        job.hls_preset_id      = jsonData['job']['hls_preset_id']
    if 'h264_preset_id' in jsonData['job']:
	job.h264_preset_id = jsonData['job']['h264_preset_id']
    job.priority           = jsonData['job']['priority']
    job.output_path        = jsonData['job']['output_path']
    job.system_path        = jsonData['job']['system_path']
    job.status		   = 'Q' # Queue

    job.save()

    response = {"job": {"id": job.id, "name": job.name}}
    #
    # La unica respuesta para esto es OK

    status = http_POST_OK
    return HttpResponse(json.dumps(response), status=status, content_type='application/json') 
开发者ID:emilianobilli,项目名称:tarecho,代码行数:28,代码来源:views.py

示例5: bpusher_PostJob

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import save [as 别名]
def bpusher_PostJob(request):

    jsonData = json.loads(request.body)

    try:
        destination = Destination.objects.get(name=jsonData['job']['destination'])
    except ObjectDoesNotExist:
        status = http_NOT_FOUND
        return HttpResponse(json.dumps({'message': 'Destination not found'}), status=status, content_type='application/json')

    job = Job()
    job.name		= jsonData['job']['name']
    job.input_name	= jsonData['job']['input_name']
    job.system_path	= jsonData['job']['system_path']
    job.input_path	= jsonData['job']['input_path']
    job.destination	= destination
    job.priority	= jsonData['job']['priority']
    job.status		= 'Q' # Queue
    

    job.save()

    response = {"job": {"id": job.id, "name": job.name}}
    #
    # La unica respuesta para esto es OK

    status = http_POST_OK
    return HttpResponse(json.dumps(response), status=status, content_type='application/json')
开发者ID:npajoni,项目名称:tubuceta,代码行数:30,代码来源:views.py

示例6: imen_PostJob

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import save [as 别名]
def imen_PostJob(request):

    jsonData = json.loads(request.body)

    try:
        preset = ThumbPreset.objects.get(name=jsonData['job']['thumb_preset'])
    except ObjectDoesNotExist:
        status = http_NOT_FOUND
        return HttpResponse(json.dumps({'message': 'ThumbPreset not found'}), status=status, content_type='application/json')


    job = Job()
    job.input_filename  = jsonData['job']['input_filename']
    job.input_path      = jsonData['job']['input_path']
    job.basename        = jsonData['job']['basename']
    job.thumb_preset    = preset
    job.priority        = jsonData['job']['priority']
    job.output_path     = jsonData['job']['output_path']
    job.status          = 'Q' # Queue

    job.save()

    response = {"job": {"id": job.id}}
    #
    # La unica respuesta para esto es OK

    status = http_POST_OK
    return HttpResponse(json.dumps(response), status=status, content_type='application/json')
开发者ID:emilianobilli,项目名称:tarecho,代码行数:30,代码来源:views.py

示例7: add_job

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import save [as 别名]
def add_job(request):
    try:
        form = JobForm(request.POST or None)
        if form.is_valid():
            required_skills = set(form.cleaned_data["required_skills"])
            optional_skills = set(form.cleaned_data["optional_skills"]) - required_skills
            with transaction.atomic():
                employer = Employer.objects.get(user=request.user)
                job = Job(
                    employer=employer,
                    description=form.cleaned_data["description"],
                    category=form.cleaned_data["category"],
                    years_of_experience=form.cleaned_data["years_of_experience"],
                    other=form.cleaned_data["other"],
                )
                job.save()
                for skill in required_skills:
                    skill = RequiredJobSkill(job=job, skill=skill)
                    skill.save()
                if optional_skills:
                    for skill in optional_skills:
                        skill = OptionalJobSkill(job=job, skill=skill)
                        skill.save()
            match_job.delay(job.id)

            messages.success(request, "Job saved successfully. You'll receive matching candidates soon")
            return HttpResponseRedirect("/")
        return render(request, "jobs/add_job.html", {"form": form})
    except Exception, e:
        logging.exception(e)
        return server_error(request)
开发者ID:evanson,项目名称:job_matcher,代码行数:33,代码来源:views.py

示例8: new_job

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import save [as 别名]
def new_job():
    if not g.site.domain == g.user:
        abort(403)

    j = Job()
    if request.method == "POST":
        portfolio = Portfolio.objects.get(site=g.site.domain)
        job_name = request.form.get("name")
        slugs = [__j.slug for __j in Job.objects.filter(site=g.site.domain)]
        counter = 1
        slug = slugify(job_name)
        __slug = slug
        while __slug in slugs:
            counter += 1
            __slug = "%s_%d" % (slug, counter)
        j.slug = __slug
        j.name = job_name
        j.site = g.site.domain
        j.categories = [ c.strip() for c in request.form.get("categories").split(",") ]
        j.intro = request.form.get("intro")
        j.description = request.form.get("description")
        j.slides = []
        texts = request.form.getlist("text")
        image_urls = request.form.getlist("image_url")
        captions = request.form.getlist("caption")
        caption_links = request.form.getlist("caption_link")
        for text, image_url, caption, caption_link in zip(texts, image_urls, captions, caption_links):
            if text or image_url:
                j.slides.append(Slide(text=text, image_url=image_url, caption=caption, caption_link=caption_link))
        j.save()
        portfolio.jobs.append(j)
        portfolio.save()
        return redirect(url_for(".job", slug=j.slug))
    return render_template("edit_job.html", job=j)
开发者ID:abal09,项目名称:samklang,代码行数:36,代码来源:portfolio.py

示例9: add

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import save [as 别名]
def add(request):
    #########################################################################################
    # 用户操作行为安全保护

    # 计时器
    timer = time.time() - request.session.get('time_stamp',0)

    # 危险操作次数
    action_times = request.session.get('action_times',0)

    # 错误次数是否大于最大
    if action_times >= 1:
        if not check_verify(request):
            return render('verify.html',locals(),context_instance=RequestContext(request))
        else:

            # 重置标志位
            reset(request)
    #########################################################################################
    current_page = 'jobs'

    # 检查用户选择的城市是否存在
    if check_city(request.GET.get('city_name',False)):
        request.session['job_city'] = request.GET.get('city_name')
    else:
        return index(request=request)

    # 打印表单
    if request.method == 'GET':
        form = JobForm()
        return render('jobs_add.html',locals(),context_instance=RequestContext(request))

    # 处理提交数据
    form = JobForm(request.POST)
    if form.is_valid():
        data = form.cleaned_data
        new_job = Job()
        new_job.title = data['title']
        new_job.city = request.session.get('job_city','北京')
        new_job.company = data['company']
        new_job.website = data['website']
        new_job.email = data['email']
        new_job.content = data['content']
        try:
            new_job.save()
        except Exception,e:
            return HttpResponse('保存招聘信息时出现错误:'+str(e))
        else:
            set(request)
            msg = '提交成功,正在等待管理员审核...'
            # 发送信号
            new_job_was_post.send(
                sender = new_job.__class__,
                job = new_job
            )
        return render('posted.html',locals(),context_instance=RequestContext(request))
开发者ID:YouThbook,项目名称:pythoner.net,代码行数:58,代码来源:views.py

示例10: schedule

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import save [as 别名]
def schedule(function, args = None, kwargs = None,
        run_after= None, meta = None):
    """Schedule a tast for execution.
    """
    job = Job(
        name=full_name(function),
            args=dumps(args or []), kwargs=dumps(kwargs or {}),
        meta=dumps(meta or {}), scheduled=run_after)
    job.save()
    return job
开发者ID:MechanisM,项目名称:django-async,代码行数:12,代码来源:api.py

示例11: main

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import save [as 别名]
def main():
    while True:
        job = Job.get_queue()
        if job:
            print 'Working on',job['_id']
            work(job)
            job['is_done'] = True
            Job.save(job)
            print 'Done'
        else:
            time.sleep(POLL_TIME)
开发者ID:jittat,项目名称:hcr-web,代码行数:13,代码来源:worker.py

示例12: jobs_post

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import save [as 别名]
def jobs_post(request): # FIXME use method POST
    job = Job()
    for field in PUBLIC_FIELDS:
        if field in request.GET:
            if field == 'params':
                job[field] = json.loads(request[field])
            else:
                job[field] = request[field]
    job.save()

    return format_job(job)
开发者ID:marinho,项目名称:london-node-jobs,代码行数:13,代码来源:views.py

示例13: job_add

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import save [as 别名]
def job_add(request, event_id, task_id):
    event = get_object_or_404(Event, pk=event_id)
    task = get_object_or_404(Task, pk=task_id)
    #job_user = get_object_or_404(User, pk=user_id)

    #if job_user != user:
    #   return HttpResponseNotAllowed('<h1>Must not add other users!</h1>')
    job = Job(event=event, task = task, user = request.user)
    job.save()
    messages.success(request, _("Took job"))
    return HttpResponseRedirect(reverse('event', args=[event.id]))
开发者ID:rangermeier,项目名称:subkoord,代码行数:13,代码来源:views.py

示例14: submit

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import save [as 别名]
    def submit(self, request):
        job = Job(query=json.dumps(self.cleaned_data["query"]))

        try:
            job.save()
        except DatabaseError:
            raise DatabaseIntegrityError()

        if self.cleaned_data["query"]["type"] == "FASTA":
            pass
        else:
            pass
开发者ID:reamdc1,项目名称:OperonEvoDB,代码行数:14,代码来源:forms.py

示例15: schedule

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import save [as 别名]
def schedule(function, args = None, kwargs = None,
        priority = 5, run_after= None, meta = None):
    """Schedule a tast for execution.
    """
    # Too many arguments
    # pylint: disable=R0913
    job = Job(
        name=full_name(function),
            args=dumps(args or []), kwargs=dumps(kwargs or {}),
        meta=dumps(meta or {}), scheduled=run_after,
        priority=priority)
    job.save()
    return job
开发者ID:DjNero,项目名称:django-async,代码行数:15,代码来源:api.py


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