def view_post(): if session.get('logged_in') is None: return redirect(url_for('PetCare.login')) postDao = PostDao() post = postDao.get_post(request.args['postId']) postInfo = Entities.make_post_output(dict(post)) return render_template('view_post.html', post=postInfo)
def view_post(): if session.get('logged_in') is None: return redirect(url_for('PetCare.login')) postDao = PostDao() post = postDao.get_post(request.args['id']) change_time_format(dict(post)) return render_template('view_post.html', post=post)
def review(): if session.get('logged_in') is None: return redirect(url_for('PetCare.login')) accountDao = AccountDao() postId = accountDao.get_account_post(session['logged_in'].rstrip()) if postId is not None: postDao = PostDao() post = postDao.get_post(postId) if post['match'] is not None: postDao.update_review(post['id'], int(request.form['review'])) accountDao.update_account_reputation(post['match'], int(request.form['review']), post['review']) if time.time() > post['end_date']: accountDao.remove_account_post(session['logged_in'].rstrip(), post['id']) return redirect(url_for('PetCare.profile', userId=post['match'])) return redirect(url_for('PetCare.list_posts'))
def view_post(): if session.get('logged_in') is None: return redirect(url_for('PetCare.login')) postDao = PostDao() post = postDao.get_post(request.args['postId']) status = 'PENDING' if post['match'] is not None and len(post['match']) > 0: status = 'MATCHED' if time.time() > post['end_date']: status = 'FINISHED' postInfo = Entities.make_post_output(dict(post)) isOwner = (session.get('logged_in') == post['owner_id']) accountDao = AccountDao() ownername = accountDao.get_name(post['owner_id']) return render_template('view_post.html', post=postInfo, status=status, isOwner=isOwner, owner=ownername)
def edit_post(): if session.get('logged_in') is None: return redirect(url_for('PetCare.login')) accountDao = AccountDao() postDao = PostDao() postId = accountDao.get_account_post(session['logged_in']) if postId is None: return redirect(url_for('PetCare.create_post')) prevPost = dict(postDao.get_post(postId)) if request.method == 'GET': # TODO: return with post information shown return render_template('edit_post.html', error=None) postInfo = Entities.make_post_info(session['logged_in'], request, prevPost) if not postInfo: return render_template('edit_post.html', error="Required Informaion Missing") postInfo['id'] = postId postDao.update_post(postInfo) return redirect(url_for('PetCare.list_posts'))