本文整理汇总了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': ''})
示例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))