def detailedSearchRating(servicename, service_id, rating, keyword): form = RatingForm() today = pass_today() email = current_user.email result = updateRating(servicename, service_id, rating, email) if result == 'success': flash('You have successfully rating it: ' + str(rating) + ' stars', 'success') data = getInfo(servicename, service_id) if form.validate_on_submit(): rating = form.rating.data session.pop('_flashes', None) return redirect( url_for('detailedSearchRating', servicename=servicename, service_id=service_id, rating=rating, keyword=keyword)) return render_template('detailedInfo.html', title='Service Imformation from Search', data=data, servicename=servicename, today=today, form=form, keyword=keyword)
def detailedInfo(servicename, service_id): form = RatingForm() today = pass_today() data = getInfo(servicename, service_id) if form.validate_on_submit(): rating = form.rating.data return redirect( url_for('detailedInfoRating', servicename=servicename, service_id=service_id, rating=rating)) return render_template('detailedInfo.html', title='Service Imformation', data=data, servicename=servicename, today=today, form=form)
def detailedInfo(servicename, service_id): form = RatingForm() today = pass_today() data = getInfo(servicename, service_id) if form.validate_on_submit(): if current_user.is_authenticated: updateRating(servicename, service_id, form.rating.data) flash('You have submitted rating successfully!', 'success') newdata = getInfo(servicename, service_id) return redirect( url_for('detailedInfo', servicename=servicename, service_id=service_id, data=newdata)) else: flash('You should login first', 'danger') return redirect(url_for('login')) return render_template('detailedInfo.html', title='Service Imformation', data=data, servicename=servicename, today=today, form=form)