本文整理汇总了Python中models.Job.content方法的典型用法代码示例。如果您正苦于以下问题:Python Job.content方法的具体用法?Python Job.content怎么用?Python Job.content使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Job
的用法示例。
在下文中一共展示了Job.content方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add
# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import content [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))
示例2: add
# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import content [as 别名]
def add(request):
current_page = 'jobs'
page_title = u'发布招聘信息'
# 检查用户选择的城市是否存在
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:
msg = '提交成功,正在等待管理员审核...'
# 发送信号
new_job_was_post.send(
sender = new_job.__class__,
job = new_job
)
return render('posted.html',locals(),context_instance=RequestContext(request))