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


Python Job.title方法代码示例

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


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

示例1: post

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import title [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: add

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import title [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

示例3: post

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import title [as 别名]
 def post(self):
     job = Job()
     job.title = self.request.get("title")
     job.description = self.request.get("description")
     job.salary = self.request.get("salary")
     job.location = self.request.get("location")
     job.industry = self.request.get("industry")
     job.contact_phone = self.request.get("contact_phone")
     job.job_type = self.request.get("job_type")
     job.company = self.request.get("company")
     job.contact_name = self.request.get("contact_name")
     job.contact_email = self.request.get("contact_email")
     job.put()
     self.response.out.write(job.to_json("title", "is_deleted", "is_active", "is_starred", "when_created"))
开发者ID:aswadrangnekar,项目名称:tiss-secure,代码行数:16,代码来源:api.py

示例4: exitJob

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import title [as 别名]
 def exitJob(self, ctx):
     for slot in self.stack.pop() :
         job = Job()
         job.source = self.context[-1]
         job.title = self.__strToken(ctx.QUOTE(0))
         job.description = self.__strToken(ctx.QUOTE(1))
         job.start = slot['begin']
         job.end = slot['end']
         job.needs = 1            
         if ctx.needs() != None :
             job.needs = self.__intToken(ctx.needs().NUMBER())
         job.protected = False
         if ctx.getChild(0).getText() == 'protected' :
             job.protected = True
         self.rows.append(job)
开发者ID:mike-matera,项目名称:SignupSheetPy,代码行数:17,代码来源:schema.py

示例5: post

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import title [as 别名]
 def post(self):
     job = Job()
     #job.poster = users.get_current_user()
     job.title = self.request.get('title')
     job.description = self.request.get('description')
     job.salary = self.request.get('salary')
     job.location = self.request.get('location')
     job.industry = self.request.get('industry')
     job.contact_phone = self.request.get('contact_phone')
     job.job_type = self.request.get('job_type')
     job.company = self.request.get('company')
     job.contact_name = self.request.get('contact_name')
     job.contact_email = self.request.get('contact_email')
     job.is_active = True
     job.put()
     #self.response.out.write(job.to_json('title', 'is_deleted', 'is_active', 'is_starred', 'when_created'))
     self.redirect('/alumni/jobs/')
开发者ID:yesudeep,项目名称:tiss-secure,代码行数:19,代码来源:handlers.py

示例6: save_job

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import title [as 别名]
    def save_job(self, html_doc):
        job = Job()

        parser = etree.HTMLParser()
        tree   = etree.parse(StringIO(html_doc), parser)

        #title
        title = tree.xpath('//td[@class=\'sr_bt\']/text()')
        for i in title:
            job.title = title[0] 
            break

        #job_detail
        job_detail = tree.xpath('//td[contains(@class, \'txt_4 wordBreakNormal job_detail\')]/div/text()')
        for i in job_detail:
            job.detail = job_detail[0]
            break
    
        welfare = tree.xpath('//span[contains(@class, \'Welfare_label\')]/text()')
        for w in welfare:
            job.welfare.add(w)

        #date location saraly
        txt1 = tree.xpath('//table[contains(@class, \'jobs_1\')]/tr/td[contains(@class, \'txt_1\')]')
        txt2 = tree.xpath('//table[contains(@class, \'jobs_1\')]/tr/td[contains(@class, \'txt_2\')]')
        
        txt1_tag = ['发布日期:', '工作地点:', '薪水范围:' ]
        for i, e in enumerate(txt1):
            if len(e.text.lstrip()) == 0:
                break
            if txt1[i].text == '发布日期:':
                #hdls[txt1[i].text] = txt2[i].text
                job.date = txt2[i].text 
            if txt1[i].text == '工作地点:':
                job.location = txt2[i].text 
            if txt1[i].text == '薪水范围:':
                job.salary = txt2[i].text 

        job.save()
        #need for speed
        self.save_company(tree)
开发者ID:AssassinPig,项目名称:flying_offer,代码行数:43,代码来源:crawler_task.py

示例7: add

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import title [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))
开发者ID:FashtimeDotCom,项目名称:pythoner.net,代码行数:40,代码来源:views.py

示例8: post

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import title [as 别名]
    def post(self):
        # Clear database of previous results
        clear_database()

        job = cgi.escape(self.request.get("job"))
        location = cgi.escape(self.request.get("location"))

        #example query, defaults to searching for a Software Engineer in San Jose
        if len(location) < 1:
            location = "San Jose, CA"
        if len(job) < 1:
            job = "Software Engineer"

        #variables using user's query that are used to search indeed & dice

        indeed_job = job.replace(" ", "+")
        indeed_loc = location.replace(" ", "+")
        indeed_loc = indeed_loc.replace(",", "%2C")

        dice_job = job.replace(" ", "+")
        dice_loc = location.replace(" ", "+")
        dice_loc = dice_loc.replace(",", "%2C")

        #base indeed & dice url where user inputs are added
        indeed_url = "http://www.indeed.com/jobs?q=%s&l=%s" % (indeed_job, indeed_loc)
        dice_url = "https://www.dice.com/jobs?q=%s&l=%s" % (dice_job, dice_loc)

        #initialize beautiful soup object for indeed and dice
        indeed = urlopen(indeed_url)
        indeed_soup = BeautifulSoup(indeed, "html.parser")

        dice = urlopen(dice_url)
        dice_soup = BeautifulSoup(dice, "html.parser")

        # INDEED Parsing
        #check for errors in indeed query
        bad_query = indeed_soup.find_all("div", {"class": "bad_query"})
        invalid_location = indeed_soup.find_all("div", {"class": "invalid_location"})

        #if there are no errors parse info from Indeed
        #Title of job, title of company, location of job, description of job, link for job
        if len(bad_query) == 0 and len(invalid_location) == 0:
            titles = indeed_soup.find_all("a", {"data-tn-element": "jobTitle"})
            companies = indeed_soup.findAll("span", {"class", "company"})
            loc = indeed_soup.find_all("span", {"class": "location"})
            desc = indeed_soup.find_all("span", {"class": "summary"})
            # jobURLS = indeed_soup.find_all("a", {"class": "jobtitle"})
            jobURLS = indeed_soup.find_all("a", {"class": "turnstileLink"})

            #add all job info to i_job
            for t, c, l, d, h in zip(titles, companies, loc, desc, jobURLS):
                print t
                if t:
                    i_job = Job()
                    i_job.title = t.get_text().strip()
                    i_job.company = c.get_text().strip()
                    i_job.location = l.get_text().strip()
                    i_job.description = d.get_text().encode("utf8").strip()
                    i_job.href = h.get("href")
                    i_job.site = "indeed"
                    i_job.put()

            # DICE Parsing
            # parse info into dice_jobs and locations
            dice_jobs = dice_soup.findAll('div', {'class': 'serp-result-content'})

            locations = dice_soup.find_all("li", {"class": "location"})
            # diceJobURLS = dice_soup.find_all("a", {"class": "dice-btn-link"})
            for job, loc in zip(dice_jobs, locations):
                d_job = Job()
                exists = job.find("a", {"class": "dice-btn-link"}).get("title")
                if exists: #if everything exists.. add job info from Dice into d_job
                    d_job = Job()
                    d_job.title = job.find("a", {"class": "dice-btn-link"}).get("title").strip()
                    d_job.company = job.find("li", {"class": "employer"}).get_text().strip()
                    desc = job.find("div", {"class": "shortdesc"}).get_text().encode("utf8")
                    d_job.description = str(desc).strip()
                    d_job.location = loc.get_text()
                    d_job.href = job.find("a", {"class": "dice-btn-link"}).get('href')
                    d_job.site = "dice"
                    # Store to database
                    d_job.put()

        else:
            print("Bad search query. Please check your spelling") #error handling.  If theres a bad query for either indeed or dice print an error

        # Query database for new jobs
        d_jobs = Job.query(Job.site == "dice").fetch()
        i_jobs = Job.query(Job.site == "indeed").fetch()
        self.response.out.write(template.render('views/index.html', {'d_jobs': d_jobs, 'i_jobs': i_jobs}))
开发者ID:gr347wh173n0r7h,项目名称:174JobScrape,代码行数:92,代码来源:main.py


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