Exemplo n.º 1
0
	def post(self):

		json = request.json
		abort_if_invalid_request_params(json, ['user'])

		resume = Resume()
		resume.user = ObjectId(json['user'])

		if 'experiences' in json:
			resume.experiences = [ObjectId(_id) for _id in json['experiences']]
		
		if 'educations' in json:
			resume.educations = [ObjectId(_id) for _id in json['educations']]
		
		if 'medcards' in json:
			resume.medcards = [ObjectId(_id) for _id in json['medcards']]
		
		if 'certificates' in json:
			resume.certificates = [ObjectId(_id) for _id in json['certificates']]
		
		if 'summary' in json:
			resume.summary = json['summary']

		resume.save()
		return me_obj_to_serializable(resume)
Exemplo n.º 2
0
def put_data_resume_in_base(data_from_resumes_list, db_session):
    all_keywords = []
    all_urls = []

    for item in Keywords.query.all():
        all_keywords.append(item.keyword)

    for item in Resume.query.all():
        all_urls.append(item.url)

    for item in data_from_resumes_list:
        if item['url'] not in all_urls:
            all_urls.append(item['url'])
            resume = Resume(item['title'], item['gender'], item['age'],
                            item['has_degree'], item['city'],
                            str(item['keywords']), item['salary'], item['url'])
            db_session.add(resume)

        for keyword in item['keywords']:
            if keyword not in all_keywords:
                all_keywords.append(item['keywords'])
                k = Keywords(keyword.lower())
                db_session.add(k)
                all_keywords.append(keyword.lower())
    db_session.commit()
Exemplo n.º 3
0
def resumes():
    """
    Resume management. Screen is gateway to perform the following actions:

    1. Create new resume
    2. Clone existing resume
    3. Delete resume
    4. Rename resume
    5. Download resume in a specific format (eg, html or txt)
    """

    # Create new resume by POSTing to this route
    # TODO: abstract this if-statement into post(), get() methods
    if request.method == 'POST':
        # TODO: form validation; whitespace, length, etc
        resume = Resume(request.form['title'], current_user)
        db.session.add(resume)
        db.session.commit()

        # TODO: abstract this "?api=1" functionality. Write api w/ subdomain?
        if request.args.get('api'):
            return jsonify(response='OK')

    # Display all of the user's resumes on this screen
    resumes = Resume.query.filter_by(user=current_user).all()
    return render_template('resumes.html', resumes=resumes, has_js=True,
                           formats=ResumeBabel.get_supported_formats())
Exemplo n.º 4
0
def resume():
    res = Resume.load(current_user.id)
    if res is not None:
        response = make_response(res.data)
        response.headers.set('Content-Type', 'application/pdf')
        return response
    flash('No generated resume found', 'danger')
    return redirect('/static/images/not-found.png')
Exemplo n.º 5
0
	def get(self):
		args = request.args

		if 'id' in args:
			return me_obj_to_serializable(Resume.objects.get(id=args['id']))
		elif 'user' in args:
			return me_obj_to_serializable(Resume.objects(user=args['user']))
		else:
			return me_obj_to_serializable(Resume.objects)
Exemplo n.º 6
0
def download():
    resume = Resume.load(current_user.id)
    if resume is not None:
        response = make_response(resume.data)
        response.headers.set('Content-Type', 'application/pdf')
        response.headers.set('Content-Disposition',
                             'attachment',
                             filename='resume.pdf')
        return response
    flash('No generated resume found', 'danger')
    return redirect(url_for('dashboard.dashboard'))
Exemplo n.º 7
0
def register_view(request, onsuccess = '/resume', onfail = '/login'):
    if request.method == 'POST':
        if not 'password' in request.POST.keys():
            return render(request, 'auth/register.html', {
                'password_err': 'Password required'
            })
        if request.POST['password'] != request.POST['confirm']:
            return render(request, 'auth/register.html', {
                'confirm_err': 'Password does not match confirmation'
            })
        elif User.objects.filter(username=request.POST['email']).count() == 0:
            user = User(username=request.POST['email'], email=request.POST['email'])
            user.set_password(request.POST['password'])
            user.save()
            resume = Resume(user = user)
            resume.save()
            return login_view(request)
        else:
            return render(request, 'auth/register.html', {
                'email_err': 'E-mail already used'
            })
    return render(request, 'auth/register.html')
Exemplo n.º 8
0
def put_data_resume_in_base(data_resumes_list, db_session):
    all_urls = []
    for item in Resume.query.all():
        all_urls.append(item.url)

    for item in data_resumes_list:
        if item['url'] not in all_urls:
            all_urls.append(item['url'])
            resume = Resume(item['title'], item['gender'],
                       item['age'], item['has_degree'],
                       item['city'], str(item['keywords']),
                       item['salary'], item['url'])
            db_session.add(resume)
    db_session.commit()
Exemplo n.º 9
0
def generate():
    content = render_latex(current_user.id)
    xtx = f'/output/{current_user.id}.xtx'
    pdf = f'/output/{current_user.id}.pdf'
    with open(xtx, 'w') as file:
        file.write(content)
    subprocess.check_call(['xelatex', '-output-directory=/output/', xtx],
                          cwd='/app/generator/')
    with open(pdf, 'rb') as file:
        data = file.read()
    resume = Resume(current_user.id, data)
    resume.save()
    commit()
    junk = [
        xtx,
        pdf,
        f'/output/{current_user.id}.aux',
        f'/output/{current_user.id}.log',
        f'/output/{current_user.id}.out',
    ]
    for path in junk:
        if os.path.isfile(path):
            os.remove(path)
    return redirect(url_for('dashboard.dashboard'))
Exemplo n.º 10
0
def clone_resume(resume_id):
    resume = Resume.query.filter_by(id=resume_id, user=current_user).first()
    if not resume:
        abort(404)

    cloned_resume = Resume(resume.title + ' [CLONE]', current_user)
    db.session.add(cloned_resume)
    db.session.commit()

    src = app.config['RESUME_FOLDER'] + ('/%d.json' % (resume_id))
    dest = app.config['RESUME_FOLDER'] + ('/%d.json' % (cloned_resume.id))
    if os.path.isfile(src):
        shutil.copy(src, dest)

    if request.args.get('api'):
        return jsonify(response='OK')
    else:
        return redirect(url_for("resumes"))
Exemplo n.º 11
0
def add_resume():
    if request.method == 'POST':
        title = title = request.form['title']
        json_data = request.form["skill_json"]
        created_time = datetime.datetime.utcnow()
        edited_time = datetime.datetime.utcnow()
        user = User.query.filter_by(id=session['user_id']).first()

        r = Resume(title=title,
                   json_data=json_data,
                   created_time=created_time,
                   edited_time=edited_time,
                   creator=user)
        db.session.add(r)
        db.session.commit()

        return redirect(url_for('show_resume'))
    user = User.query.filter_by(id=session['user_id']).first()

    return render_template("add_resume.html", title='Add Resume', user=user)
Exemplo n.º 12
0
def index():
    if 'linkedin_token' in session:
        me = linkedin.get(
            'people/~:(first-name,last-name,headline,picture-url,public-profile-url,formatted-name,summary,skills,email-address,main-address,phone-numbers,industry)'
        )
        # user=User(nickname="ahsan",email="*****@*****.**")
        # db.session.add(user)
        # db.session.commit()
        # return jsonify(me.data)
        u = User(me.data['formattedName'], me.data['emailAddress'])

        flag = u.signUp()
        print '-------------------------------'
        print me.data['industry']

        if flag == 1:
            first_resume = {}
            first_resume['firstName'] = me.data['firstName']
            first_resume['lastName'] = me.data['lastName'],
            first_resume['skills'] = me.data['skills']
            first_resume['emailAddress'] = me.data['emailAddress']

            # first_resume['address']=me.data['mainAddress']

            jso = json.dumps(first_resume)

            r = Resume(title='first linkedin resume', json_data=jso, creator=u)
            db.session.add(r)
            db.session.commit()
        num = u.getId()
        print(u.id)
        session['user_id'] = (num)
        return render_template("index.html", title='Home', user=me)
        # return jsonify(me.data)

    return render_template("login.html")
Exemplo n.º 13
0
	def post(self, request, *args, **kwargs):
		data = get_form_data(request)

		# stvaranje rtf dokumenta i spremanje životopisa
		doc = create_rtf_document(data)
		r = Resume()
		file_name = request.POST.get('save', '')
		if file_name:
			r.name = file_name
			file_name = file_name.replace(' ', '_')
			file_name = file_name + '.rtf'
			write_file(doc, file_name)
		r.date_created = datetime.now()
		r.user = request.user
		r.save()

		# spremanje životopisa za kasnije uređivanje
		for k in data.keys():
			field_type = 'T' if len(data[k][1]) < 50 else 'A'
			f = Field(order=k, label=data[k][0], value=data[k][1], checked=data[k][2], field_type=field_type, resume=r)
			f.save()

		return HttpResponseRedirect(reverse_lazy('cv_list_url'))
Exemplo n.º 14
0
				</div><!--// bd -->

			</div><!-- // inner -->


		</div><!--// doc -->


		</body>
		</html> """

		return message



resume = Resume("Janice Konadu", "Full-Stack Developer", "[NUMBER]", "[EMAIL]")


fb_url = "[FACEBOOK URL]"
dvp_url = "[DEVPOST URL]"
gh_url = "[GITHUB URL]"



dvp_page = requests.get(dvp_url)
dp_soup = BeautifulSoup(dvp_page.content, 'html.parser')

# prj = dp_soup.find_all('h5')
# dvpLst = getMemberLst(prj)

Exemplo n.º 15
0
def dashboard():
    resume = Resume.load(current_user.id)
    download_disabled = True
    if resume is not None:
        download_disabled = False
    return render_template('dashboard.html', download_disabled=download_disabled)
Exemplo n.º 16
0
    return render_template('register.html', form=form)


if __name__ == "__main__":
    # Create test context to set up db
    ctx = app.test_request_context()
    ctx.push()

    # Create db tables
    db.create_all()

    # Create initial admin user if they don't already exist
    if not User.query.filter_by(email='admin').first():
        u = User('admin', 'admin', 'peach')
        u.admin = True
        db.session.add(u)

        r1 = Resume('Test Resume', u)
        db.session.add(r1)
        r2 = Resume('Google Resume', u)
        db.session.add(r2)

        db.session.commit()

    ctx.pop()

    # Start server
    port = int(os.environ.get("PORT", 5000))
    app.run('0.0.0.0', port)