Esempio n. 1
0
def profile(user_email):


    form_rating=forms.submitRating()
    form_review=forms.submitReview()
    user=db.session.query(Client).filter(Client.email==user_email).one()

    owner=False
    if user==current_user:
        owner=True

    return render_template('AUBOOST/profile.html',user=user,email=user_email,loggedIn=True,profile_page=True,owner=owner
                           ,form_rating=form_rating,form_review=form_review,courses=user.getCourses())
Esempio n. 2
0
def review(user_email):
    person_being_reviewed=db.session.query(Client).filter(Client.email==user_email).one()
    form =forms.submitReview()
    review = form.review.data
    if(person_being_reviewed!= None and review!=None):
        id_of_reviewer=current_user.id
        id_person_being_rated=person_being_reviewed.id
        #db.session.query(Rating).filter_by(reviewer_id=1,reviewed_id=1).one()

        review_person=Reviews(id_of_reviewer,id_person_being_rated,review)
        try:
            db.session.add(review_person)
            db.session.commit()
        except Exception as e:
            flash(("flash_error", "Error Submiting review, you are allowed with one review"))
            print str(e)
            return redirect(url_for('AUBOOST.profile',user_email=user_email))

    flash(("flash_notification", "Successfully submited review."))
    return redirect(url_for('AUBOOST.profile',user_email=user_email))