Refactoring to handle not logged in users
This commit is contained in:
@@ -13,16 +13,15 @@ from sqlalchemy.orm.exc import MultipleResultsFound, NoResultFound
|
|||||||
# Views
|
# Views
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
def homepage():
|
def homepage():
|
||||||
|
latest_application = None
|
||||||
if current_user.is_authenticated():
|
if current_user.is_authenticated():
|
||||||
applications = Application.query\
|
applications = Application.query\
|
||||||
.filter_by(blender_id=current_user.id)\
|
.filter_by(blender_id=current_user.id)\
|
||||||
.all()
|
.all()
|
||||||
|
for application in applications:
|
||||||
latest_application = None
|
if application.status != 'rejected':
|
||||||
for application in applications:
|
latest_application = application
|
||||||
if application.status != 'rejected':
|
break
|
||||||
latest_application = application
|
|
||||||
break
|
|
||||||
|
|
||||||
return render_template('index.html', application=latest_application, title='home')
|
return render_template('index.html', application=latest_application, title='home')
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user