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


Python Job.user方法代码示例

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


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

示例1: post

# 需要导入模块: from jobs.models import Job [as 别名]
# 或者: from jobs.models.Job import user [as 别名]
 def post(self, request):
     json_data = json.loads(request.body)
     company = Company.objects.get(user=request.user)
     job = Job(**json_data)
     job.company = company
     job.user = request.user
     job.save()
     return JsonResponse({"status": "ok", "id": job.id, 'msg': ''})
开发者ID:EdwardBetts,项目名称:myFirstProfile,代码行数:10,代码来源:views.py

示例2: create

# 需要导入模块: from jobs.models import Job [as 别名]
# 或者: from jobs.models.Job import user [as 别名]
def create(request, create_form=CreateJobForm,
           template_name='jobs/create_form.html', success_url=None,
           extra_context=None):
	
	#profile = Profile.objects.get(user_id=request.user.id)
	#if profile and not(profile.if_employer):
	#	return render_to_response('jobs/index.html', {'form': form}, context_instance=RequestContext(request))

	form = create_form()

	if request.method == 'POST':
		form = create_form(request.POST, request.FILES)

		if form.is_valid():
			job = Job()
			job.user = request.user
			job.name = form.cleaned_data['name']
			job.location = form.cleaned_data['location']
			job.intern_project = form.cleaned_data['intern_project']
			job.save()

			# split by new line
			names_values = form.cleaned_data['names_values'].split('\n')
			# go trough all names and values
			for name_value in names_values:
				# skip extra spaces and split by first colon
				result = ' '.join(name_value.split()).split(":", 1)
				# when name and value
				if len(result) == 2:
					parameter = JobParameter()
					parameter.name = result[0].strip()
					parameter.value = result[1].strip()
					parameter.container = job
					parameter.save()

			return redirect('/jobs')
	return render_to_response('jobs/create_form.html', {'form': form}, context_instance=RequestContext(request))
开发者ID:nehulyadav,项目名称:solesite,代码行数:39,代码来源:views.py


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