Add ability to upload resume after already being registered. (hack)
This commit is contained in:
parent
bef822e4d2
commit
4cfa0f2578
2 changed files with 45 additions and 0 deletions
29
flask_app.py
29
flask_app.py
|
@ -60,6 +60,35 @@ def root():
|
|||
print("Someone visited!.")
|
||||
return render_template('index.html')
|
||||
|
||||
@app.route('/resumepost', method=['POST'])
|
||||
def resumepost():
|
||||
"""A last minute hack to let people post their resume after they've already registered"""
|
||||
if request.method == 'POST':
|
||||
if not is_logged_in() or db.session.query(
|
||||
db.exists().where(Hacker.mlh_id == session['mymlh']['id'])).scalar():
|
||||
# Request flow == messed up somehow, restart them
|
||||
return redirect(url_for('register'))
|
||||
|
||||
if 'resume' not in request.files:
|
||||
return "You tried to submit a resume with no file"
|
||||
|
||||
resume = request.files['resume']
|
||||
if resume.filename == '':
|
||||
return "You tried to submit a resume with no file"
|
||||
|
||||
if resume and not allowed_file(resume.filename):
|
||||
return jsonify(
|
||||
{'status': 'error', 'action': 'register',
|
||||
'more_info': 'Invalid file type... Accepted types are txt pdf doc docx and rtf...'})
|
||||
|
||||
if resume and allowed_file(resume.filename):
|
||||
# Good file!
|
||||
filename = session['mymlh']['first_name'].lower() + '_' + session['mymlh']['last_name'].lower() + '_' + str(
|
||||
session['mymlh']['id']) + '.' + resume.filename.split('.')[-1].lower()
|
||||
filename = secure_filename(filename)
|
||||
resume.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
|
||||
return "Resume uploaded!"
|
||||
|
||||
|
||||
@app.route('/register', methods=['GET', 'POST'])
|
||||
def register():
|
||||
|
|
|
@ -19,6 +19,22 @@
|
|||
You can park at the <a href="https://www.google.com/maps/place/Hackfeld+Lot/@42.274131,-71.8112764,16.88z/data=!4m5!3m4!1s0x89e406f433008cd5:0xba67db4fec56e85c!8m2!3d42.2728874!4d-71.8128909">Hackfeld Lot</a>. Please make sure to print and put this <a href="../static/parking_placecard.pdf">placecard</a>.
|
||||
<br>
|
||||
Let us know if you have any questions by sending them to hack@wpi.edu
|
||||
<br>
|
||||
Forgot to upload your resume while registering? No worries, submit it here:
|
||||
|
||||
<form method="post" action="/resumepost" enctype="multipart/form-data">
|
||||
<p><b>If you'd like, add your resume to send to sponsors... </b></p>
|
||||
<div class="file-field input-field">
|
||||
<div class="btn">
|
||||
<span>File</span>
|
||||
<input id="resume" name="resume" type="file"/>
|
||||
</div>
|
||||
<div class="file-path-wrapper">
|
||||
<input class="file-path validate" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<input name="submit" class="btn btn-lg btn-primary btn-invert" type="submit" value="Submit"/>
|
||||
</form>
|
||||
{% endif %}
|
||||
<br>
|
||||
<a href="#" id="drop-link"><p class="sub-button btn waves-effect waves-light grey darken-1">Drop Application if you can't make it :(</p></a>
|
||||
|
|
Loading…
Add table
Reference in a new issue