Пример #1
0
def department_create_department(parent_id, name):
    '''
    [
        {"name": "parent_id", "required": 1, "check": "int", "description": "父部门ID"},
        {"name": "name", "required": 1, "check": "string", "description": "部门名"}
    ]
    '''
    # 规定parent_id = -1时,是根部门
    if parent_id == -1:
        parent = Department.get_root_department(current_enterprise.object_id)
    else:
        parent = Department.query.filter(
            Department.enterprise_id == current_enterprise.object_id,
            Department.object_id == parent_id).first()
        if not parent:
            return custom(-1, "部门不存在")
    department = Department(name=name,
                            parent_id=parent.object_id,
                            enterprise_id=current_enterprise.object_id)
    db.session.add(department)

    def callback(dep):
        return dep.to_json()

    return commit_callback(callback=callback, param=(department, ))
Пример #2
0
def ModifyDepartment(dep_id):
    form = DepartmentForm()
    if form.validate_on_submit():
        department_name = form.department_name.data.strip()
        if dep_id is None:
            department = Department.query.filter(
                Department.name == department_name).first()
            if form.create.data is True:
                if department is not None:
                    flash('Отдел с таким названием уже существует.')
                else:
                    department = Department(name=department_name)
                    db.session.add(department)
                    db.session.commit()
                    flash('Отдел успешно создан.')
            elif form.delete.data is True:
                if department is None:
                    flash('Такого отдела не существует.')
                else:
                    db.session.delete(department)
                    db.session.commit()
                    flash('Отдел успешно удалён.')
        else:
            department = Department.query.filter(
                Department.id == dep_id).first()
            if department is None:
                flash('Такого отдела не существует.')
            else:
                department.name = department_name
                db.session.commit()
                flash('Отдел успешно изменён.')
    else:
        for error in form.department_name.errors:
            flash(error)
    return redirect(url_for('main.ShowUsers'))
def import_professors(df):
    for i in tqdm(df.iterrows()):
        pid, series = i
        pname = series.Name
        score = None if str(series.Score) == 'nan' else series.Score
        nrev = None if str(series.Num_Reviews) == 'nan' else series.Num_Reviews
        if series.Nugget == 'None':
            nuggets = None
        elif series.Nugget == 'Gold':
            nuggets = 1
        else:
            nuggets = 0
        p = Professor(pid=pid,
                      pname=pname,
                      nuggets=nuggets,
                      score=score,
                      nrev=nrev)

        dparsed = ast.literal_eval(series.Dept)
        if dparsed:
            if isinstance(dparsed, list):
                for d in dparsed:
                    dname, did = d
                    dquery = Department.query.filter(
                        Department.did == did).first()
                    if dquery:
                        p.departments.append(dquery)
                    else:
                        d = Department(dname=dname, did=did)
                        p.departments.append(d)
            else:
                dname, did = dparsed
                dquery = Department.query.filter(Department.did == did).first()
                if dquery:
                    p.departments.append(dquery)
                else:
                    d = Department(dname=dname, did=did)
                    p.departments.append(d)

        cparsed = ast.literal_eval(series.Courses)
        if cparsed:
            if isinstance(cparsed, list):
                for c in cparsed:
                    cname, cid = c
                    cquery = Course.query.filter(Course.cid == cid).first()
                    if cquery:
                        p.courses.append(cquery)
                    else:
                        c = Course(cname=cname, cid=cid)
                        p.courses.append(c)
            else:
                cname, cid = cparsed
                cquery = Course.query.filter(Course.cid == cid).first()
                if cquery:
                    p.courses.append(cquery)
                else:
                    c = Course(cname=cname, cid=cid)
                    p.courses.append(c)
        db.session.add(p)
        db.session.commit()
Пример #4
0
def department_insert_data():
    departments = {
        u'管理中心': (None,''),
        u'技术中心': (None, ''),
        u'营销中心': (None, ''),
        u'行政部': (Department.query.filter_by(name=u"管理中心").first(),''),
        u'财务部': (Department.query.filter_by(name=u"管理中心").first(), ''),
        u'运维部': (Department.query.filter_by(name=u"技术中心").first(), ''),
        u'DBA部': (Department.query.filter_by(name=u"技术中心").first(), ''),
        u'开发部': (Department.query.filter_by(name=u"技术中心").first(), ''),
        u'测试部': (Department.query.filter_by(name=u"技术中心").first(), ''),
        u'市场部': (Department.query.filter_by(name=u"营销中心").first(), ''),
        u'活动部': (Department.query.filter_by(name=u"营销中心").first(), ''),
    }
    for r in departments:
        department = Department.query.filter_by(name=r).first()
        if department is None:
            department = Department(name=r)
        if isinstance(departments[r][0], int):
            department.parent_id = departments[r][0]
        else:
            department.parent = departments[r][0]
        department.description = departments[r][1]
        db.session.add(department)
    db.session.commit()
    print "Insert department test data."
Пример #5
0
 def setUp(self):
     TestFactory.setUp(self)
     data = []
     data.append(Department(descripcion="padre", user_id=1))
     data.append(Department(descripcion="hijo", user_id=1, parent_id=1))
     db.session.add_all(data)
     db.session.commit()
     self.path = '/departments'
Пример #6
0
 def setUp(self):
     self.app = create_app('testing')
     self.app_context = self.app.app_context()
     self.app_context.push()
     db.drop_all()
     db.create_all()
     Department.insert_departments()
     Degree.insert_degrees()
     HolidayType.insert_holiday_types()
Пример #7
0
 def test_department_in_school(self):
     s = School(name='tsxy')
     db.session.add(s)
     db.session.commit()
     d = Department(name='cs')
     d.school = s
     db.session.add(d)
     db.session.commit()
     self.assertTrue(d in s.departments)
Пример #8
0
def reset_db():
    flash('Resetting Database: deleting old data and repopulating with dummy data')
    # clear all data from all tables
    meta = db.metadata
    for table in reversed(meta.sorted_tables):
        print('Clear table {}'.format(table))
        db.session.execute(table.delete())
    db.session.commit()

    # populate tables with dummy data
    users = [
        User(username='******', name='Professor Pancake', email='*****@*****.**', bio='Not a professor, definitely a pancake'),
        User(username='******', name='Mouse Cop', email='*****@*****.**', bio='Cat no like mouse. Cat like coding WORM'),
        User(username='******', name='Little Russian Lady', email='*****@*****.**', bio='Please... get me some beets'),
    ]
    users[0].set_password('cat1')
    users[1].set_password('cat2')
    users[2].set_password('cat3')

    db.session.add_all(users)
    db.session.commit()

    users[0].send_request(users[2])
    users[1].send_request(users[0])
    users[2].send_request(users[1])


    departments = [
        Department(name='Computer Science', abbr='COMP'),
        Department(name='Languages', abbr='LNGS'),
        Department(name='Mathematics', abbr='MATH')
    ]
    db.session.add_all(departments)

    courses = [
        Course(name='Principles of Computer Science II', number=172, department=departments[0]),
        Course(name='Introduction to Data Structures', number=220, department=departments[0]),
        Course(name='Language and the Mind', number=242, department=departments[1]),
        Course(name='Statistics', number=124, department=departments[2]),
        Course(name='Intro to WORM Programming', number=999, department=departments[0]),
    ]
    db.session.add_all(courses)

    associations = [
        MentorToCourse(mentor=users[0], course=courses[1]),
        MentorToCourse(mentor=users[0], course=courses[0]),
        MentorToCourse(mentor=users[1], course=courses[3]),
        MentorToCourse(mentor=users[1], course=courses[4]),
        MentorToCourse(mentor=users[2], course=courses[2]),
    ]
    db.session.add_all(associations)

    db.session.commit()

    return redirect(url_for('index'))
Пример #9
0
def dept_add(request):
    """
    添加部门
    :param request:
    :return:
    """
    if request.method == 'GET':
        # 展示所有部门名称,用于显示上级部门下拉选择框
        departments = Department.objects.filter(is_delete=0)
        return render(request, 'dept/deptAdd.html', {'departments': departments})

    if request.method == 'POST':
        msg = {
            'code': 0,
            'msg': '请求成功'
        }
        data = request.POST.dict()
        # 获取部门编号
        d_id = data.get('d_id')
        # 查询是否已存在此部门
        department = Department.objects.filter(d_id=d_id)
        # 如果存在, 则更改部门信息
        if department:
            department = department.first()
        else:
            # 不存在此部门,则新增一个部门
            department = Department()
        # 保存部门信息
        department.department = data.get('department')
        department.department_num = data.get('department_num')
        department.higher_id = data.get('higher_id')
        department.description = data.get('description')
        department.save()
        return JsonResponse(msg)
 def setUp(self):
     self.app = create_app('testing')
     self.app_context = self.app.app_context()
     self.app_context.push()
     db.create_all()
     Role.insert_roles()
     LeaveType.insert_leave_type()
     Department.insert_department()
     self.client = self.app.test_client(use_cookies=True)
     self.pw = 'cat'
     self.user = User(email='*****@*****.**', username='******', password=self.pw, gender=Gender.MALE, department_id=1)
     self.admin = User(email='*****@*****.**', username='******', password='******', gender=Gender.MALE, department_id=1)
     self.admin.role = Role.query.filter_by(name='Administrator').first()
     db.session.add(self.user, self.admin)
     db.session.commit()
Пример #11
0
    def insert_departments(self):
        departments = extract_master_files_data(
            self.org_dir, DATATYPES_NAMES["department_name"])

        for dep in departments:
            dep_duplicate = self.if_duplicate_exists(Department,
                                                     number=dep.number,
                                                     org_id=self.org_id)
            if dep_duplicate:
                continue

            # check for group with non-existing number
            valid_group = db.session.query(Group).filter_by(
                number=dep.group_number).first()
            if not valid_group:
                dep.group_id = None
            else:
                dep.group_id = valid_group.id

            db_dep = Department(number=dep.number,
                                date_time=dep.date_time,
                                filepath=dep.filepath,
                                data_dir=dep.data_dir,
                                org_id=self.org_id,
                                name=dep.name,
                                group_id=dep.group_id)
            db.session.add(db_dep)
            db.session.commit()
            print(db_dep)
Пример #12
0
def add_department():
    """添加"""
    req_dict = request.get_json()
    addr = req_dict.get('addr')
    department = req_dict.get('department')
    subjects = req_dict.get('subjects')
    print("++++添加部门++++",req_dict)
    # 校验数据
    param_keys = ["addr","department","subjects"]
    param_dict = dict()
    for i in param_keys:
        param_dict.__setitem__(i,req_dict.get(i,''))
    for key,value in param_dict.items():
        if not value:
            return jsonify(errno=RET.PARAMERR, errmsg="数据不完整,缺少%s"%key)
    try:
        exist = Department.query.filter_by(addr=addr,department=department).all()
        if exist:
            return jsonify(errno=RET.DBERR,errmsg="数据有重复")
        obj = Department(addr=addr,department=department,subjects=subjects)
        db.session.add(obj)
        db.session.commit()
    except Exception as e:
        current_app.logger.error(e)
        db.session.rollback()
        return jsonify(errno=RET.UNKOWNERR, errmsg="添加失败")
    return jsonify(errno=RET.OK, errmsg="成功")
Пример #13
0
def SaveDepartFormJson():
    form = depart_form.DepartForm()
    data = {'Tag': 0, "Message": ""}
    if form.validate_on_submit():
        data["Tag"] = 1
        data["Message"] = "操作成功"
        if form.Id.data > 0:
            print("修改")
            menu = Department.query.get(form.Id.data)
            menu.ParentId = form.ParentId.data
            menu.DepartName = form.DepartName.data
            menu.User_id = form.PrincipalId.data
            menu.Mobile = form.Mobile.data
            menu.Fax = form.Fax.data
            menu.Email = form.Email.data
            menu.Remarks = form.Remarks.data
            menu.DepartSort = form.DepartSort.data
            menu.ModifyTime = datetime.now()

        else:
            menu = Department(ParentId=form.ParentId.data,
                              DepartName=form.DepartName.data,
                              User_id=form.PrincipalId.data,
                              Mobile=form.Mobile.data,
                              Fax=form.Fax.data,
                              Email=form.Email.data,
                              Remarks=form.Remarks.data,
                              DepartSort=form.DepartSort.data,
                              CreateTime=datetime.now(),
                              ModifyUserid=1,
                              CreateUserid=1)
            db.session.add(menu)
        db.session.commit()

    return jsonify(data)
Пример #14
0
def add_department():
    """
    Add a department to the database
    """
    #  Throws a 403 Forbidden error if a non-admin user attempts to access these views.
    check_admin()

    add_department = True

    form = DepartmentForm()
    if form.validate_on_submit():

        department = Department(name=form.name.data)  # Todo add a  description parameter

        try:
            # add a department to the database
            db.session.add(department)
            db.session.commit()

            logger.info(f'Department {department.name} has been added')

            flash('The new department have been successfully added !')
        except exc.IntegrityError:
            logger.exception('Add department exc.IntegrityError')
            flash('Error: department name already exists.')

        return redirect(url_for('admin.list_departments'))

    return render_template('admin/departments/department.html', action='Add',
                           add_department=add_department,
                           form=form,
                           title='Add Department')
Пример #15
0
    def test_department_model_ifDelete(self):
        # create test department
        department1 = Department(name="IT1", description="The IT1 Department")
        department2 = Department(name="IT2", description="The IT2 Department")

        # save department to database
        db.session.add(department1)
        db.session.add(department2)
        db.session.commit()

        db.session.delete(department2)

        chDepartment1 = Department.query.filter_by(name='IT1').first()

        self.assertEqual(Department.query.count(), 1)
        self.assertEqual(department1, chDepartment1)
Пример #16
0
def add_department():
    """
    Add a department to the database
    """

    add_department = True

    form = DepartmentForm()
    if form.validate_on_submit():
        department = Department(name=form.name.data,
                                description=form.description.data)
        try:
            # add department to the database
            db.session.add(department)
            db.session.commit()
            flash('You have successfully added a new department.')
        except:
            # in case department name already exists
            flash('Error: department name already exists.')

        # redirect to departments page
        return redirect(url_for('admin.list_departments'))

    # load department template
    return render_template('admin/departments/department.html',
                           action="Add",
                           add_department=add_department,
                           form=form,
                           title="Add Department")
Пример #17
0
    def setUp(self):
        TestFactory.setUp(self)
        data = []
        data.append(State(descripcion="abierto"))
        data.append(State(descripcion="cerrado"))
        data.append(Priority(descripcion="baja"))
        data.append(Priority(descripcion="Alta"))
        data.append(Department(descripcion="default"))
        data.append(Client(nombre="default"))
        db.session.add_all(data)
        db.session.commit()
        data = Ticket(
            titulo="prueba",
            content=
            """My money's in that office, right? If she start giving me some bullshit about it ain't there, and we got to go someplace 
			else and get it, I'm gonna shoot you in the head then and there. Then I'm gonna shoot that bitch in the kneecaps, find out where my 
			goddamn money is. She gonna tell me too. Hey, look at me when I'm talking to you, m**********r. You listen: we go in there, and that
			 n***a Winston or anybody else is in there, you the first m**********r to get shot. You understand?""",
            email="*****@*****.**",
            client_id=1,
            department_id=1,
            priority_id=1,
            state_id=1,
            user_id=1)
        db.session.add(data)
        db.session.commit()
        self.path = '/tickets'
Пример #18
0
def dept_fake():
    depts = ['销售部', '财务部', '技术部', '总经理办公室', '行政部', '客服部', '研发部', '数据部']
    for dept in depts:
        d = Department(
            dept_name=dept)
        db.session.add(d)
        db.session.commit()
Пример #19
0
	def post(self):
		department = Department(
			name=request.json["name"]
		)
		db.session.add(department)
		db.session.commit()
		return department_schema.dump(department)
    def test_reassign(self):
        """Test that an admin user can assign a new role and a new department
           to an employee."""
        department = Department(name=test_department2_name,
                                description=test_department2_description)

        role = Role(name=test_role2_name, description=test_role2_description)

        db.session.add(department)
        db.session.add(role)
        db.session.commit()

        self.login_admin_user()

        self.driver.find_element_by_id('employees_link').click()
        time.sleep(1)

        self.driver.find_element_by_class_name('fa-user-plus').click()
        time.sleep(1)

        select_dept = Select(self.driver.find_element_by_id('department'))
        select_dept.select_by_visible_text(test_department2_name)
        select_role = Select(self.driver.find_element_by_id('role'))
        select_role.select_by_visible_text(test_role2_name)
        self.driver.find_element_by_id('submit').click()
        time.sleep(2)

        success_message = self.driver.find_element_by_class_name('alert').text
        assert 'You have successfully assigned a department and role' in success_message

        employee = Employee.query.get(2)
        self.assertEqual(employee.role.name, test_role2_name)
        self.assertEqual(employee.department.name, test_department2_name)
    def setUp(self):
        """Setup the test driver and create test users."""
        self.driver = webdriver.Chrome()
        self.driver.get(self.get_server_url())

        db.session.commit()
        db.drop_all()
        db.create_all()

        self.admin = Employee(username=test_admin_username,
                              email=test_admin_email,
                              password=test_admin_password,
                              is_admin=True)

        self.employee = Employee(username=test_employee1_username,
                                 first_name=test_employee1_first_name,
                                 last_name=test_employee1_last_name,
                                 email=test_employee1_email,
                                 password=test_employee1_password)

        self.department = Department(name=test_department1_name,
                                     description=test_department1_description)

        self.role = Role(name=test_role1_name,
                         description=test_role1_description)

        db.session.add(self.admin)
        db.session.add(self.employee)
        db.session.add(self.department)
        db.session.add(self.role)
        db.session.commit()
Пример #22
0
def add_department():
    check_admin()
    add_department = True
    form = DepartmentForm()
    if form.validate_on_submit():
        department = Department(name=form.name.data,
                                description=form.description.data)
        try:
            # add department to the database
            db.session.add(department)
            db.session.commit()
            flash('Đã thêm phòng ban thành công.')
        except:
            # in case department name already exists
            flash('Lỗi: Tên phòng ban đã tồn tại.')

        # redirect to departments page
        return redirect(url_for('admin.list_departments'))

    # load department template
    return render_template('admin/departments/department.html',
                           action="add",
                           add_department=add_department,
                           form=form,
                           title="Thêm phòng ban")
Пример #23
0
 def test_remove_from_department(self):
     a = User(name='sorvihead',
              password='******',
              role=Role.query.filter_by(name='Administrator').first())
     m = User(name='sorvihead',
              password='******',
              role=Role.query.filter_by(name='Moderator').first())
     user = User(name='sorvihead',
                 password='******',
                 role=Role.query.filter_by(name='User').first())
     u = User(name='test', password='******')
     db.session.add_all([a, u, m, user])
     db.session.commit()
     s = Shop(name='afi', shop_code='9066')
     d = Department(name='kids')
     a.add_to_shop(user, s)
     a.add_to_department(user, d)
     a.remove_from_department(user, d)
     self.assertFalse(user.department == d)
     a.add_to_department(user, d)
     a.remove_from_shop(user, s)
     self.assertFalse(user.department == d)
     a.add_to_shop(user, s)
     a.add_to_department(user, d)
     self.assertRaises(PermissionError, u.remove_from_department, user, d)
Пример #24
0
    def test_department_model(self):
        department = Department(name="Infrastructure",
                                description="The infrastructure department")
        db.session.add(department)
        db.session.commit()

        self.assertEqual(Department.query.count(), 1)
Пример #25
0
    def test_accept_request(self):
        a = User(name='sorvihead',
                 password='******',
                 role=Role.query.filter_by(name='Administrator').first())
        m = User(name='sorvihead',
                 password='******',
                 role=Role.query.filter_by(name='Moderator').first())
        user = User(name='sorvihead',
                    password='******',
                    role=Role.query.filter_by(name='User').first())
        u = User(name='test', password='******')
        db.session.add_all([a, u, m, user])
        db.session.commit()
        s = Shop(name='afi', shop_code='9066')
        d = Department(name='kids')
        r = Request(description='test', user=u, shop=s, department=d)
        r2 = Request(description='test2', user=u, shop=s, department=d)
        r3 = Request(description='test3', user=u, shop=s, department=d)
        db.session.add_all([s, d, r, r2, r3])
        db.session.commit()
        a.accept_request(r)
        m.accept_request(r2)

        db.session.add(r)
        db.session.commit()
        self.assertTrue(r.approved)
        self.assertTrue(r2.approved)
        self.assertRaises(PermissionError, user.accept_request, r3)
Пример #26
0
def insert_dept():
    # Check if table already exists or not
    if db.session.query(Department).first() is None:
        departments = load_departments()
        for dept in departments:
            db.session.add(Department(**dept))
        db.session.commit()
Пример #27
0
class NewIssueForm(Form):
    title = StringField(id="title")
    department = SelectField(id="department",
                             choices=Department().query.with_entities(Department.id, Department.name).all())
    priority = RadioField(id="priority", choices=[
        ("low", "Low"), ("med", "Medium"), ("high", "High")
    ])
    description = TextAreaField(id="description")
def get_department(session, state_id, department_type):
    """Get department from database"""
    department = session.query(Department).filter(
        Department.state_id == state_id).filter(
            Department.department_type == department_type).first()
    if department is None:
        department = Department()
        state = session.query(State).get(state_id)
        if not state:
            state = State()
            state.id = state_id
            session.add(state)
        department.state_id = state.id
        department.department_type = department_type
        session.add(department)
        session.commit()
    return department
Пример #29
0
 def test_department_model(self):
     """
     Test number of records in deparment table
     """
     department = Department(name="IT", description="Technology Dept")
     db.session.add(department)
     db.session.commit()
     self.assertEqual(Department.query.count(), 1)
Пример #30
0
    def create(name):
        if DepartmentEntity.does_exists(name) == 1:
            return 0, 'Department already exists', None

        department = Department(name=name)
        db.session.add(department)
        db.session.commit()
        return 1, 'Department created successfully', DepartmentEntity(department=department).get_serialized()
Пример #31
0
        ['Sys block', '123456', '123456'],
        ['Monitor', '214365', '214365'],
        ['Faks', '432165', '432165'],
        ['Scanner', '654321', '654321'],
        ['Sys block', '1324356', '1324356']
        ]

users = [
        ['Serg', 'Porokh'],
        ['Vasyl', 'Chereda'],
        ['Musiy', 'Storoguk']
        ]

departments = ['jur', 'it']

d = Department(departments[0])
u1 = User(users[0][0],users[0][1])
u2 = User(users[1][0],users[1][1])
d.set_user(u1)
d.set_user(u2)
eq1 = Equipment(equipment[0][0], equipment[0][1], equipment[0][2])
eq2 = Equipment(equipment[1][0], equipment[1][1], equipment[1][2])
u1.set_equipment(eq1)
u1.set_equipment(eq2)
eq3 = Equipment(equipment[2][0], equipment[2][1], equipment[2][2])
u2.set_equipment(eq3)
db.add(eq1)
db.add(eq2)
db.add(eq3)
db.add(u1)
db.add(u2)
Пример #32
0
dep_us = {
    u'ІТ': [
        (u'Порох', u'Сергій'),
        (u'Копайбіда', u'Олег'),
        (u'Череда', u'Василь')
        ],
    u'Юридичний': [
        (u'Порошенко', u'Петро'),
        (u'Копач', u'Світлана')
        ],
    u'Бухгалтерія': [
        (u'Калюжна', u'Ірина')
        ]
        }

for dep in dep_us.keys():
    d = Department(dep)
    for us in dep_us[dep]:
        u = User(us[0], us[1])
        for eq in us_quip[us]:
            e = Equipment(eq[0], eq[1], eq[2])
            u.set_equipment(e)
            db.add(e)
        d.set_user(u)
        db.add(u)
    db.add(d)
    db.commit()


Пример #33
0
    from django.contrib.auth.hashers import make_password
    from app.models import Department, Person, Project, ProjectGrp, TaskTime, ProjectType

    # using unicode as the password coding
    yun_hua = User(username='******', email='*****@*****.**', password=make_password('hello'))
    yonghua_xu = User(username='******', email='*****@*****.**', password=make_password('hello'))
    yinye_fan = User(username='******', email='*****@*****.**', password=make_password('hello'))
    admin = User(username='******', email='*****@*****.**', password=make_password('hello'))
    yun_hua.save()
    yonghua_xu.save()
    yinye_fan.save()
    admin.save()

    # yun_hua = User.objects.get(username='******')

    engineering = Department(dept_id=600800, name='技术工程部', summary='Engineering')
    engineering.save()
    admin_dept = Department(dept_id=600310, name='行政部', summary='Admin')
    admin_dept.save()

    # engineering = Department.objects.get(dept_id='600800')

    person1 = Person(user=yun_hua, employee_id=149, privilege=1, department=engineering)
    person1.save()
    person2 = Person(user=yonghua_xu, employee_id=61, privilege=1, department=engineering)
    person2.save()
    person3 = Person(user=yinye_fan, employee_id=99, privilege=1, department=engineering)
    person3.save()
    person_admin = Person(user=admin, employee_id=0, privilege=1, department=engineering)
    person_admin.save()