Ejemplo n.º 1
0
    def generate_experience(self, nr, serialize=False):
        result = []

        for x in range(nr):
            domain = self.__domains[random.randint(0, len(self.__domains) - 1)]
            projects = self.generate_projects(random.randint(1, 5), False)
            exp = Experience(domain, random.randint(1, 15), projects)
            result.append(exp)

        if serialize:
            return [exp.serialize() for exp in result]
        else:
            return result
Ejemplo n.º 2
0
def deleteinfo():
    if request.method == "GET":
        return render_template("deleteinfo.html")
    if request.method == "POST":
        new_info = Experience.objects(title=request.form["title"]).first()
        if new_info is not None:
            new_info.delete()
        return render_template("deleteinfo.html")
Ejemplo n.º 3
0
def add_experience(student_id):
    exp_data = request.form.to_dict()

    experience = Experience(**exp_data)
    students = Student.objects(id=student_id)
    for student in students:
        student.experience.append(experience)
        return save_model(student)

    return "Not found", 404
Ejemplo n.º 4
0
def addImage():
    if request.method == "GET":
        return render_template("addimage.html")
    if request.method == "POST":
        new_info = Experience()
        new_info.from_ = request.form["time"]
        new_info.title = request.form["title"]
        new_info.description = request.form["description"]
        # new_info.image = request.files["image"]
        new_info.save()
        return render_template("addimage.html")
Ejemplo n.º 5
0
    def run(self):
        Employer.objects.delete()
        employers = self.get_employers()
        for e in employers:
            print "Creating employer %s" % e
            employer = Employer(**e)
            employer.save()

        Student.objects.delete()
        students = self.get_students()

        experiences = self.get_experiences()
        for i in range(len(experiences)):
            experience_list = experiences[i]
            s = students[i]
            for e in experience_list:
                s.experience = [Experience(**e)]
                s.save()

        educations = self.get_educations()
        for s in students:
            education = choice(educations)
            s.education = [Education(**education)]
            s.save()

        employers = Employer.find({})
        jobs = self.get_jobs()
        for i in range(len(jobs)):
            j = jobs[i]
            e = employers[i]
            j['employer_id'] = e['id']
            job = Job(**j)
            job.save()

        jobs = Job.find({})

        self.save_applications(jobs, students)
role_list = list()
role_list.append(UserProfileRole(role_value='HR', role_name='hr'))
role_list.append(UserProfileRole(role_value='Lead', role_name='lead'))

category_list = list()
category_list.append(
    Category(category_name='programming_language',
             category_value='Programming languages'))
category_list.append(
    Category(category_name='framework', category_value='Framework'))
category_list.append(Category(category_name='tool', category_value='Tool'))
category_list.append(Category(category_name='other', category_value='Other'))
experience_list = list()
experience_list.append(
    Experience(experience_name='less_than_one',
               experience_value='less than 1 year'))
experience_list.append(
    Experience(experience_name='from_one_to_two', experience_value='1 - 2'))
experience_list.append(
    Experience(experience_name='from_two_to_three', experience_value='2 - 3'))
experience_list.append(
    Experience(experience_name='from_three_to_five', experience_value='3 - 5'))
experience_list.append(
    Experience(experience_name='from_five_to_ten', experience_value='5 - 10'))
experience_list.append(
    Experience(experience_name='more_than_ten', experience_value='10 +'))

company_range_list = list()
company_range_list.append(CompanyRange(size_name='zero', size_value='0'))
company_range_list.append(
    CompanyRange(size_name='from_1_to_20', size_value='1 - 20'))
Ejemplo n.º 7
0
def Mio_CV():
    return render_template("Mio_CV.html", experience_list=Experience.objects())
Ejemplo n.º 8
0
n=3 #quantity of records in the file
f="data/resume_random_gen1.json"

for o, a in opts:
    if o=="-n":
        n=int(a)
    elif o=="-f":
        f=a

def random_string(prefix, maxlen):
    symbols = string.ascii_letters+string.digits
    return prefix+"".join([random.choice(symbols) for i in range(random.randrange(maxlen))])


testdata=[Resume(None, random_string("first_name", 10), random_string("last_name", 15), random_string("email", 20),
        random_string("phone", 12), random_string("address", 50), random_string("city", 30), 
        random_string("state", 30), random_string("country", 20), random_string("zip_code", 5),
        random_string("job_title", 50), random_string("summary", 50),
        [Education(None, None, random_string("organization_name", 20), random_string("description", 20), 
            random_string("title", 20), start_date='2020-01-01', end_date='2020-01-01')], 
        [Experience(None, None, random_string("position", 20), random_string("company_name", 20), 
            random_string("description", 20), start_date='2020-01-01', end_date='2020-01-01')])
    for i in range(n)
]

file = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", f)

with open(file, "w") as fw:
    jsonpickle.set_encoder_options("json", indent=2)
    fw.write(jsonpickle.encode(testdata))