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


Python Job.objects方法代码示例

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


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

示例1: job

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import objects [as 别名]
def job(id):
        if request.method == 'GET':
		jobs = Job.objects(jobid=id)
	        if request_wants_json():
		  return jsonify(item=[job.to_json() for job in jobs])
	        else:
        	  return render_template('list_jobs.html',jobs=jobs)
	if request.method == 'POST':
		job = Job.objects(jobid=id).first()
	        if request_has_json():
			job.description =  request.json['description']
	                job.save()
			return 'Updated'
                else:
                        form = AddJobForm(request.form)
		        form.populate_obj(job)
			job.save()
			return render_template('list_jobs.html',jobs=[job])
开发者ID:niravshah,项目名称:refrew,代码行数:20,代码来源:views.py

示例2: list_jobs

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import objects [as 别名]
def list_jobs(records_to_fetch, last, user):
    new_last = int(last) + int(records_to_fetch)
    if(user != ''):
        jobs = Job.objects(user=user)[int(last):new_last]
    else:
        jobs = Job.objects[int(last):new_last]
    if request_wants_json():
        itemLst = [dict(job.to_mongo()) for job in jobs]
        return mongodoc_jsonify(items=itemLst)
    return render_template('list_jobs.html', jobs=jobs)
开发者ID:niravshah,项目名称:refrew,代码行数:12,代码来源:jobs.py

示例3: job_referral

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import objects [as 别名]
def job_referral(jobid):
    if request.method == 'GET':
        job = Job.objects(jobid=jobid).first()
        referrals = Referral.objects(job=job)
        return render_template('_referrals.html', referrals=referrals)
    if request.method == 'POST':
        if request_has_json():
            try:
                job = Job.objects(jobid=int(request.json['job'])).first()
                request.json['job'] = str(job.id)
                model = Referral.from_json(
                    json.dumps(request.json, default=json_util.default))
                model.status = 'Submitted'
                model.save()
                return jsonify(item='Submitted')
            except ValidationError as e:
                return jsonify(item=str(e))
        else:
            print 'Request does not have JSON!'
开发者ID:niravshah,项目名称:refrew,代码行数:21,代码来源:jobs.py

示例4: job

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import objects [as 别名]
def job(jobid):
    if request.method == 'GET':
        job = Job.objects(jobid=int(jobid)).first()
        stages = Stage.objects(job=job)
        ref = Referral.objects(job=job)
        if request_wants_json():
            return mongodoc_jsonify(item=job.to_mongo())
        else:
            return render_template('list_job.html', job=job, referrals=ref, stages=stages)
    if request.method == 'PUT':
        job = Job.objects(jobid=int(jobid)).first()
        if request_has_json():
            json_data = json.dumps(request.json, default=json_util.default)
            model = Job.from_json(json_data)
            job.locationName = model.locationName
            job.title = model.title
            job.permOrCont = model.permOrCont
            job.remuneration = model.remuneration
            job.tSkill1 = model.tSkill1
            job.tSkill2 = model.tSkill2
            job.tSkill3 = model.tSkill3
            job.pSkill1 = model.pSkill1
            job.pSkill2 = model.pSkill2
            job.pSkill3 = model.pSkill3
            job.qalNeeded = model.qalNeeded
            job.qal = model.qal
            job.projChar1 = model.projChar1
            job.projChar2 = model.projChar2
            job.projChar3 = model.projChar3
            job.teamChar1 = model.teamChar1
            job.teamChar2 = model.teamChar2
            job.teamChar3 = model.teamChar3
            job.save()
            '''Job.objects(jobid=int(jobid)).first().update(json_data)'''
            return mongodoc_jsonify(item=job.reload().to_mongo())
        else:
            form = AddJobForm(request.form)
            form.populate_obj(job)
            job.save()
            return render_template('list_job.html', jobs=[job])
开发者ID:niravshah,项目名称:refrew,代码行数:42,代码来源:jobs.py

示例5: stages

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import objects [as 别名]
def stages(jobid):
    if request.method == 'GET':
        job = Job.objects(jobid=int(jobid)).first()
        stages = Stage.objects(job=job)
        itemLst = [dict(stage.to_mongo()) for stage in stages]
        return mongodoc_jsonify(items=itemLst)
    if request.method == 'POST':
        if request_has_json():
            try:
                job = Job.objects(jobid=int(jobid)).first()
                reward = Reward.objects(itemid=request.json['reward']).first()
                model = Stage()
                model.job = job
                model.reward = reward
                model.rewardDesc = reward.itemid
                model.jobDesc = str(job.jobid)
                model.stage = request.json['stage']
                model.save()
                model.reload()
                return mongodoc_jsonify(item=model.to_mongo())
            except ValidationError as e:
                return jsonify(item=str(e))
开发者ID:niravshah,项目名称:refrew,代码行数:24,代码来源:jobs.py

示例6: edit_job_form

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import objects [as 别名]
def edit_job_form(id):
    job = Job.objects(jobid=id).first()
    stages = Stage.objects(job=job)
    form = AddJobForm(request.form, obj=job,)
    return render_template('add_job.html', form=form, edit=True, stages=stages)
开发者ID:niravshah,项目名称:refrew,代码行数:7,代码来源:jobs.py

示例7: change_job_referral_status

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import objects [as 别名]
def change_job_referral_status(jobid, refid, value):
    job = Job.objects(jobid=int(jobid)).first()
    referral = Referral.objects(job=job, itemid=refid).first()
    referral.status = value
    referral.save()
    return job_referral(jobid)
开发者ID:niravshah,项目名称:refrew,代码行数:8,代码来源:jobs.py

示例8: user_job_referrals

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import objects [as 别名]
def user_job_referrals(jobid, userid):
    job = Job.objects(jobid=int(jobid)).first()
    referrals = Referral.objects(job=job, user=userid)
    return jsonify(item=[(dict(itemid=ref.itemid, job=ref.job.jobid, user=ref.user, referenceName=ref.referenceName, reference=ref.reference, status=ref.status))for ref in referrals])
开发者ID:niravshah,项目名称:refrew,代码行数:6,代码来源:jobs.py

示例9: add_job_stage

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import objects [as 别名]
def add_job_stage(id):
    stage = StageForm()
    stage.job.data = Job.objects(jobid=id).first().id
    return render_template('add_stage.html', form=stage)
开发者ID:niravshah,项目名称:refrew,代码行数:6,代码来源:jobs.py

示例10: list_jobs

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import objects [as 别名]
def list_jobs():
	jobs = Job.objects()
	if request_wants_json():
        	return jsonify(items=[job.to_json() for job in jobs])
	return render_template('list_jobs.html',jobs=jobs)
开发者ID:niravshah,项目名称:refrew,代码行数:7,代码来源:views.py


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