• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python models.Employee类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: create_invoice

def create_invoice():
    if Security.is_login(SK):
        item = Item()
        employee = Employee()
        return render_template('invoice/create_invoice.html', title='Create Invoice', items=item.get_items(),
                               employees=employee.get_employees())
    return redirect(url_for('login', callback=stack()[0][3]))
开发者ID:dsantosp12,项目名称:PyTry,代码行数:7,代码来源:PyTry.py


示例2: profile_handler

def profile_handler(doc, name, url, path):
    filename = os.path.join(path, name + ".html")
    employee = Employee(name=name, url=url)

    # 只保存名称和个人主页,个人简历文件另存当前目录
    soup = BeautifulSoup(doc, Config.SOUP_PARSER)
    divs = soup.find_all(name="div", attrs={"id":"phy-main"}, limit=1)
    if not divs or len(divs) == 0:
        return employee

    div = divs[0]
    if not os.path.exists(filename):
        with open(filename, 'wb') as fp:
            content = div.prettify()
            fp.write(content)
            fp.close()
    
    #email
    email_div = soup.find_all(name='a',class_="phy-mail")
    if email_div and len(email_div) != 0:
        employee.email = email_div[0].get_text().strip()

    te_div = soup.find_all(name='a',class_="phy-phone")
    if te_div and len(te_div) != 0:
        employee.tel = te_div[0].get_text().strip()
    
    # 使用纯文本方式处理
    lines = div.stripped_strings
    # text=div.get_text(strip=True)
    parser = ProfileParser(lines=lines,employee=employee,set_attr_hook=set_attr_hook)
    return parser.parse()
开发者ID:Jumbo-WJB,项目名称:EduParser,代码行数:31,代码来源:MyHandler.py


示例3: profile_handler

def profile_handler(doc, name, url, path):
    filename = os.path.join(path, name + ".html")
    employee = Employee(name=name, url=url)

    # 只保存名称和个人主页,个人简历文件另存当前目录
    soup = BeautifulSoup(doc, Config.SOUP_PARSER)
    divs = soup.find_all(name="div", attrs={"id":"right_2"}, limit=1)
    if not divs or len(divs) == 0:
        return employee

    div = divs[0]
    if not os.path.exists(filename):
        with open(filename, 'wb') as fp:
            content = div.prettify()
            fp.write(content)
            fp.close()
    
    researches = [' ',' ']
    tds = div.find_all(name="td",attrs={"bgcolor":"#FFFFFF","class":"ft12","valign":"top"},limit=4)
    if len(tds) == 4:
        researches[0] = tds[2].get_text().strip()
        researches[1] = tds[3].get_text().strip()
        employee.research = researches[0] + ";" +researches[1]
        print "research:" + employee.research 
    # 使用纯文本方式处理
    lines = div.stripped_strings
    # text=div.get_text(strip=True)
    parser = ProfileParser(lines=lines,employee=employee,ignore=set(['research']))
    return parser.parse()
开发者ID:Jumbo-WJB,项目名称:EduParser,代码行数:29,代码来源:MyHandler.py


示例4: profile_handler

def profile_handler(doc, name, url, path):
    filename = os.path.join(path, name + ".html")
    employee = Employee(name=name, url=url)

    # 只保存名称和个人主页,个人简历文件另存当前目录
    soup = BeautifulSoup(doc, Config.SOUP_PARSER)
    divs = soup.find_all(name="div", class_="box_rt01 list", limit=1)
    if not divs or len(divs) == 0:
        div = soup
    else:
        div = divs[0]

    with open(filename, 'wb') as fp:
        content = div.prettify()
        fp.write(content)
        fp.close()

    h3s = div.find_all('h3')
    if h3s and len(h3s) != 0:
        title = h3s[0].get_text()
        title = ''.join(title.split())
        print title
        for t in PROFILE_TITLES:
            if t in title:
                employee.title = title
                print "got => " + title
                break
    else:
        print "not found h3"
    # 使用纯文本方式处理
    lines = div.stripped_strings
    # text=div.get_text(strip=True)
    parser = ProfileParser(lines=lines,employee=employee,force_email=True)
    return parser.parse()
开发者ID:Jumbo-WJB,项目名称:EduParser,代码行数:34,代码来源:MyHandler.py


示例5: index

def index(request):
  e = Employee(name="John",
               role="manager",
               email='[email protected]')
  e.hire_date = datetime.datetime.now().date()
  #e.put()
  day1 = datetime.timedelta(days=1)
  trendslist=[]
  gtrendslist=[]
  yesterday = datetime.date.today()-day1
  query = Trend.all().filter('created >= ', yesterday).order('-created')
  results = query.fetch(100)
  for p in results:
    trendslist.append(p.title)
 
  
        
  gv = globvars
  context = {
    'thispage':'Home',
    'trends':trendslist,
    'gtrends':gtrendslist,
      }
  context = dict(context, **gv.context) #combines the 'local' context with the 'global' context
  return render_to_response('index.html', context)
开发者ID:m1ck,项目名称:hottrends,代码行数:25,代码来源:views.py


示例6: post

    def post(self):
        if (self.request.get('username')):
            user = self.request.get('username')
        else:
            user = self.session['username']
        employee_query = Employee.query(Employee.login_name == user)
        employee = employee_query.fetch()[0]

        timesheet_query = Timesheet.query(Timesheet.time_period == self.request.get('time_period'), Timesheet.worked_by == employee.key)
        timesheet = timesheet_query.fetch()

        currentPositions = []
        for sheet in timesheet:
            currentPositions.append(sheet.position)

        for position in employee.positions:
            if position not in currentPositions:
                new_timesheet = Timesheet(worked_by=employee.key, position=position, time_period=self.request.get('time_period'))
                new_timesheet.put()
                timesheet.append(new_timesheet)

        jsonSheet = {'sheets': []}
        for t in timesheet:
            obj = {
                'worked_by': Employee.query(Employee.key == t.worked_by).fetch()[0].login_name,
                'position': Position.query(Position.key == t.position).fetch()[0].title,
                'hours_worked': t.hours_worked,
                'time_period': t.time_period,
                'is_submitted': t.is_submitted,
                'is_approved': t.is_approved
            }
            jsonSheet['sheets'].append(obj)

        self.response.headers['Content-Type'] = 'application/json'
        self.response.write(json.dumps(jsonSheet))
开发者ID:kulczajr,项目名称:custom-timesheet,代码行数:35,代码来源:main.py


示例7: test_callingGetEmployeesReturnsListOfDicts

	def test_callingGetEmployeesReturnsListOfDicts(self):
		Employee.objects.filter = mock.MagicMock()
		company = Company()
		company.pk = 98
		employee_one = Employee()
		employee_one.pk = 12
		employee_one.user = User()
		employee_one.user.first_name = 'Fornavn'
		employee_one.user.last_name = 'Efternavn'
		employee_one.company = company
		employee_two = Employee()
		employee_two.pk = 13
		employee_two.user = User()
		employee_two.user.first_name = 'Fornavn'
		employee_two.user.last_name = 'Efternavn'
		employee_two.company = company
		Employee.objects.filter.return_value = [employee_one, employee_two]
		employee_one.getMyEmployees = mock.MagicMock()
		employee_one.getMyEmployees.return_value = []
		employee_list = employee_one.getEmployees()
		self.assertEquals(2, len(employee_list))
		self.assertTrue(isinstance(employee_list[0], dict))
		self.assertTrue(isinstance(employee_list[0]['manager'], Employee))
		self.assertEquals(employee_list[0]['manager'].pk, 12)
		self.assertTrue(isinstance(employee_list[0]['employees'], list))
		self.assertEquals(employee_list[0]['manager'].user.first_name, 'Fornavn')
		self.assertEquals(employee_list[0]['manager'].user.last_name, 'Efternavn')
开发者ID:crmtoolboxgit,项目名称:nxtlvl,代码行数:27,代码来源:oldtests.py


示例8: test_callingGetDevelopmentPlansWithAsManagerEqualToTrueCallsFilterWithOwnerManagerAsArgument

	def test_callingGetDevelopmentPlansWithAsManagerEqualToTrueCallsFilterWithOwnerManagerAsArgument(self):
		employee = Employee()
		employee.pk = 38
		DevelopmentPlan.objects.filter = mock.MagicMock()
		DevelopmentPlan.objects.filter.return_value.order_by = mock.MagicMock()
		employee.getDevelopmentPlans(as_manager=True)
		DevelopmentPlan.objects.filter.assert_called_once_with(owner__manager__pk=38)
开发者ID:crmtoolboxgit,项目名称:nxtlvl,代码行数:7,代码来源:oldtests.py


示例9: test_callingGetEmployeesCallsFilterOnEmployeeWithCompanyPkAsArgumentAndIsMangerEqualToTrue

	def test_callingGetEmployeesCallsFilterOnEmployeeWithCompanyPkAsArgumentAndIsMangerEqualToTrue(self):
		employee = Employee()
		company = Company()
		company.pk = 8
		employee.company = company
		with mock.patch.object(Employee, 'objects') as query_mock:
			employee.getEmployees()
			query_mock.filter.assert_called_with(company__pk=company.pk, is_manager=True)
开发者ID:crmtoolboxgit,项目名称:nxtlvl,代码行数:8,代码来源:oldtests.py


示例10: handler

def handler(tag):
    name = tag.get_text()
    name = ''.join(name.split())
    names = name.split('_')
    name = names[0]
    employee = Employee(url=tag['href'], name=name)
    if len(names) >= 2:
        employee.title = names[1]
    return employee
开发者ID:Jumbo-WJB,项目名称:EduParser,代码行数:9,代码来源:MyHandler.py


示例11: profile_handler

def profile_handler(doc,name,url,path):
    # employee可用属性(url, name, email, tel, title, profile, research, departments,fax,addr):
    symbols = {
        u'Email:'    :'email',
        u'邮箱:'      :'email',
        u'电子邮件:'   :'email',
        u'电子邮箱:'   :'email',
        u'电话:'      :'tel',  
        u'联系电话:'   :'tel',
        u'Tel:'       :'tel',
        u'办公电话:'   :'tel',
        u'传真:'      :'fax',  
        u'URL:'      :'url',
        u'职称:'      :'title'
    }
    employee = None
    
    # 太乱了,只保存名称和个人主页,个人简历文件另存当前目录
    soup = BeautifulSoup(doc, Config.SOUP_PARSER)
    divs = soup.find_all(id="s2_right_con",limit=1)
    filename = path+name+".html"
    if not divs or len(divs) == 0:
        return Employee(name=name,url=url)
    div =divs[0]
    with open(filename,'wb') as fp:
        content = div.prettify()
        fp.write(content)
        fp.close()
     
    
    employee = Employee()
    # parse name
    name_h4 = div.h4
    if name_h4:
        employee.name = name_h4.string.strip(' \t\n\r')
    else:
        print name_h4
    
    for tag in div.children:
        if not tag.string:
            continue
        text = tag.string.strip(' \t\n\r')
        if len(text) == 0:
            continue
        for symbol,name in symbols.items():
            idx = text.find(symbol)
            if idx != -1:
                idx += len(symbol)
                value = text[idx:]
                if hasattr(employee, name):
                    setattr(employee, name, value)
                    symbols
                    # print (name + ":" + value)
                else:
                    print ("no attr %s in employee" % name)
                break
    return  employee
开发者ID:yixiaoyang,项目名称:pyScripts,代码行数:57,代码来源:MyHandler.py


示例12: test_callingCanAssociateNewPlanReturnsFalseIfTheEmployeeHasAnOpenDevelopmentPlan

	def test_callingCanAssociateNewPlanReturnsFalseIfTheEmployeeHasAnOpenDevelopmentPlan(self):
		employee = Employee()
		employee.pk = 38
		employee.user = User()
		employee.user.pk = 9
		CompetenceFieldCollectionToUserRelation.objects.filter = mock.MagicMock()
		CompetenceFieldCollectionToUserRelation.objects.filter.return_value.exists = mock.MagicMock()
		CompetenceFieldCollectionToUserRelation.objects.filter.return_value.exists.return_value = [CompetenceFieldCollectionToUserRelation(employee.user, finished_at=None),]
		self.assertFalse(employee.canAssociateNewPlan())
		CompetenceFieldCollectionToUserRelation.objects.filter.assert_called_once_with(user__pk=employee.user.pk, finished_at=None)
开发者ID:crmtoolboxgit,项目名称:nxtlvl,代码行数:10,代码来源:oldtests.py


示例13: test_callingGetDevelopmentPlansCallsFilterAndOrderByOnDevelopmentPlanWithGivenUserAsArgument

	def test_callingGetDevelopmentPlansCallsFilterAndOrderByOnDevelopmentPlanWithGivenUserAsArgument(self):
		employee = Employee()
		employee.pk = 38
		employee.user = User()
		employee.user.pk = 9
		DevelopmentPlan.objects.filter = mock.MagicMock()
		DevelopmentPlan.objects.filter.return_value.order_by = mock.MagicMock()
		employee.getDevelopmentPlans()
		DevelopmentPlan.objects.filter.assert_called_once_with(owner__pk=38)
		DevelopmentPlan.objects.filter.return_value.order_by.assert_called_once_with('-created_at')
开发者ID:crmtoolboxgit,项目名称:nxtlvl,代码行数:10,代码来源:oldtests.py


示例14: setUp

    def setUp(self):
        self.region = Region(name="test_region")
        self.region.save()
        self.company = Company(code="1001", name="test_company", region=self.region)
        self.company.save()

        self.store = Store(code="10011001", name="test_store", company=self.company)
        self.store.save()

        self.emp_region = Employee(username="emp_region", organization=self.region)
        self.emp_company = Employee(username="emp_company", organization=self.company)
        self.emp_store = Employee(username="emp_store", organization=self.store)
开发者ID:xhacker5000,项目名称:wandoujia-oem,代码行数:12,代码来源:tests.py


示例15: handler

def handler(tag):
    employee = Employee()
    name_divs = tag.find_all("div",class_="teacher-title")
    if name_divs and len(name_divs) != 0:
        employee.name = name_divs[0].get_text()
        employee.name = ''.join(employee.name.split())
    
    # 使用纯文本方式处理
    lines = tag.stripped_strings
    # text=div.get_text(strip=True)
    parser = ProfileParser(lines=lines,employee=employee)
    return parser.parse()
开发者ID:yixiaoyang,项目名称:pyScripts,代码行数:12,代码来源:MyHandler.py


示例16: make_emp

def make_emp(line, cp):
    flds = line.split('^')
    if Employee.has_payrecord(flds[1]):
        return Employee.get_by_name(flds[1])
    return Employee.create(
        dfn=flds[0],
        name=flds[1],
        grade=int(flds[2]),
        step=int(flds[3]),
        fte=int(float(flds[4]) * 100),
        cp=cp
    )
开发者ID:Davincier,项目名称:payrun,代码行数:12,代码来源:import_data.py


示例17: post

    def post(self):
        dept = self.request.get("department")
        user = users.get_current_user()

        e = Employee(user=user, department=dept)
        e.put()

        mail.send_mail(sender="Random Lunch <[email protected]>",
              to=user.nickname(),
              subject="Get Ready to Meet HubSpotters",
              body="Thanks! You'll get an email soon matching you up with your first lunch date.")

        self.redirect("/thanks/")
开发者ID:hartleybrody,项目名称:random-lunch,代码行数:13,代码来源:main.py


示例18: new_user

def new_user(request):
	use = User.objects.create_user(request.GET['username'],'',request.GET['pass'])
	use.last_name = request.GET['lname']
	use.first_name = request.GET['fname']
	use.save()
	new_date = datetime.date.today() - datetime.timedelta(days=1)
	e = Employee()
	e.user = use
	e.lastVoted = new_date
	e.save()
	user = authenticate(username=request.GET['username'],password=request.GET['pass'])
	login(request,user)
	return HttpResponseRedirect('/home/')
开发者ID:flexairconsultant,项目名称:gamereview,代码行数:13,代码来源:views.py


示例19: test_callingGetDevelopmentPlansReturnsListOfDevelopmentPlans

	def test_callingGetDevelopmentPlansReturnsListOfDevelopmentPlans(self):
		employee = Employee()
		employee.pk = 38
		employee.user = User()
		employee.user.pk = 9
		development_plan_one = DevelopmentPlan()
		development_plan_two = DevelopmentPlan()
		DevelopmentPlan.objects.filter = mock.MagicMock()
		DevelopmentPlan.objects.filter.return_value.order_by = mock.MagicMock()
		DevelopmentPlan.objects.filter.return_value.order_by.return_value = [development_plan_one, development_plan_two]
		development_plans = employee.getDevelopmentPlans()
		self.assertEquals(2, len(development_plans))
		self.assertTrue(isinstance(development_plans[0], DevelopmentPlan))
开发者ID:crmtoolboxgit,项目名称:nxtlvl,代码行数:13,代码来源:oldtests.py


示例20: testCache

 def testCache(self):
     pin='5'
     self.assertEquals(Employee.objects.all().count(), self.c)
     self.assertEquals(Employee.objects.get(PIN=pin).PIN, pin)
     self.assertEquals(Employee.objects.count(), self.c)
     Employee.clear()
     self.assertEquals(Employee.objects.count(), 0)
     self.assertEquals(Employee.objects.filter(PIN=pin).count(), 0)
     try:
         emp=Employee.objects.get(PIN=pin)
     except:
         emp=None
     self.assertEquals(emp, None)
开发者ID:SongJLG,项目名称:johan-doc,代码行数:13,代码来源:tests.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python models.Entry类代码示例发布时间:2022-05-27
下一篇:
Python models.Email类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap