Beispiel #1
0
    def post(self):
        if not self.user:
            self.redirect('/login')
        u = self.request.get('university')
        d = self.request.get('degree')
        g = self.request.get('gpa')
        y_s = self.request.get('year_start')
        y_g = self.request.get('year_graduate')

        if (u):
            e = Education(parent = education_key(),
                          user = self.user,
                          university = u)
            if (d):
                e.degree = d
            if (g):
                e.gpa = g
            if (y_s):
                e.year_start = y_s
            if (y_g):
                e.year_graduate = y_g
            e.put()
            self.redirect('/about_me')
        else:
            self.render('errorpage.html', error = "No University Provided")
 def get(self, user_name):
     user_other = User.by_name(user_name)
     if user_other:
         other_education = Education.query(
             Education.user.name == user_name).fetch()
         self.render('aboutme.html',
                     education=other_education,
                     user_other=user_other)
     else:
         self.render('errorpage.html',
                     error="Sorry, that user could not be found.")
Beispiel #3
0
def add_education(student_id):
    student = Student.by_id(student_id)

    edu = request.form.to_dict()
    education = Education(**edu)
    students = Student.objects(id=student_id)
    for student in students:
        student.education.append(education)
        return save_model(student)

    return "Not found", 404
Beispiel #4
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)
def intern_education_route(user_id):
    if request.method == 'POST':
        content = request.get_json()
        education = Education()
        return education.add_education(user_id, content)
Beispiel #6
0
 def get(self):
     education = Education.query(Education.user == self.user).fetch()
     self.render('aboutme.html', education=education)
Beispiel #7
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))